diff options
author | Rob Landley <rob@landley.net> | 2019-12-12 22:02:35 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-12-12 22:02:35 -0600 |
commit | 953b23aad3577bcf47b0962ebb286b655add58ba (patch) | |
tree | eaa0fb91449b844cf1c59f22b4a4a38690efe6f5 /lib/xwrap.c | |
parent | 03495651d78b8d802e1aa31e330aa93899a9386a (diff) | |
download | toybox-953b23aad3577bcf47b0962ebb286b655add58ba.tar.gz |
Next round of toysh work, with associated lib plumbing.
Diffstat (limited to 'lib/xwrap.c')
-rw-r--r-- | lib/xwrap.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c index 591c9513..cfd17219 100644 --- a/lib/xwrap.c +++ b/lib/xwrap.c @@ -224,7 +224,7 @@ void xexec(char **argv) // If -1, replace with pipe handle connected to stdin/stdout. // NULL treated as {0, 1}, I.E. leave stdin/stdout as is // return: pid of child process -pid_t xpopen_both(char **argv, int *pipes) +pid_t xpopen_setup(char **argv, int *pipes, void (*callback)(void)) { int cestnepasun[4], pid; @@ -269,6 +269,7 @@ pid_t xpopen_both(char **argv, int *pipes) close(pipes[1]); } } + if (callback) callback(); if (argv) xexec(argv); // In fork() case, force recursion because we know it's us. @@ -309,6 +310,12 @@ pid_t xpopen_both(char **argv, int *pipes) return pid; } +pid_t xpopen_both(char **argv, int *pipes) +{ + return xpopen_setup(argv, pipes, 0); +} + + // Wait for child process to exit, then return adjusted exit code. int xwaitpid(pid_t pid) { |