|
@ -302,6 +302,10 @@ int ChildProcess::Spawn(const char *file, char *const args[], char **env) { |
|
|
return -3; |
|
|
return -3; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Save environ in the case that we get it clobbered
|
|
|
|
|
|
// by the child process.
|
|
|
|
|
|
char **save_our_env = environ; |
|
|
|
|
|
|
|
|
switch (pid_ = vfork()) { |
|
|
switch (pid_ = vfork()) { |
|
|
case -1: // Error.
|
|
|
case -1: // Error.
|
|
|
Shutdown(); |
|
|
Shutdown(); |
|
@ -324,6 +328,9 @@ int ChildProcess::Spawn(const char *file, char *const args[], char **env) { |
|
|
_exit(127); |
|
|
_exit(127); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Restore environment.
|
|
|
|
|
|
environ = save_our_env; |
|
|
|
|
|
|
|
|
// Parent.
|
|
|
// Parent.
|
|
|
|
|
|
|
|
|
ev_child_set(&child_watcher_, pid_, 0); |
|
|
ev_child_set(&child_watcher_, pid_, 0); |
|
|