mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* win32/win32.c (do_spawn): fix the bug which the environment variables
had not spread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@2829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b8d5224113
commit
209a9a125e
2 changed files with 14 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Sep 9 20:41:03 2002 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* win32/win32.c (do_spawn): fix the bug which the environment variables
|
||||
had not spread.
|
||||
|
||||
Sun Sep 8 19:21:48 2002 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* dir.c (rb_glob): add prototype of 2nd argument to avoid VC++ warning.
|
||||
|
|
|
@ -741,7 +741,9 @@ char *cmd;
|
|||
int status = -1;
|
||||
char *shell, *cmd2;
|
||||
int mode = NtSyncProcess ? P_WAIT : P_NOWAIT;
|
||||
char **env = NULL;
|
||||
|
||||
env = win32_get_environ();
|
||||
/* save an extra exec if possible */
|
||||
if ((shell = getenv("RUBYSHELL")) != 0) {
|
||||
if (NtHasRedirection(cmd)) {
|
||||
|
@ -765,15 +767,17 @@ char *cmd;
|
|||
argv[1] = "-c";
|
||||
argv[2] = cmdline;
|
||||
argv[4] = NULL;
|
||||
status = spawnvpe(mode, argv[0], argv, environ);
|
||||
status = spawnvpe(mode, argv[0], argv, env);
|
||||
/* return spawnle(mode, shell, shell, "-c", cmd, (char*)0, environ); */
|
||||
free(cmdline);
|
||||
if (env) win32_free_environ(env);
|
||||
return (int)((status & 0xff) << 8);
|
||||
}
|
||||
}
|
||||
else if ((shell = getenv("COMSPEC")) != 0) {
|
||||
if (NtHasRedirection(cmd) /* || isInternalCmd(cmd) */) {
|
||||
status = spawnle(mode, shell, shell, "/c", cmd, (char*)0, environ);
|
||||
status = spawnle(mode, shell, shell, "/c", cmd, (char*)0, env);
|
||||
if (env) win32_free_environ(env);
|
||||
return (int)((status & 0xff) << 8);
|
||||
}
|
||||
}
|
||||
|
@ -792,14 +796,16 @@ char *cmd;
|
|||
}
|
||||
*a = NULL;
|
||||
if (argv[0]) {
|
||||
if ((status = spawnvpe(mode, argv[0], argv, environ)) == -1) {
|
||||
if ((status = spawnvpe(mode, argv[0], argv, env)) == -1) {
|
||||
free(argv);
|
||||
free(cmd2);
|
||||
if (env) win32_free_environ(env);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
free(cmd2);
|
||||
free(argv);
|
||||
if (env) win32_free_environ(env);
|
||||
return (int)((status & 0xff) << 8);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue