diff options
author | Ron Yorston <rmy@pobox.com> | 2021-10-14 13:28:46 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-10-14 13:39:23 +0100 |
commit | d78bd61e556d8cd728414b553edf3ccd30580b4d (patch) | |
tree | 604fcd441c6e19d71efe08b0ae4581d042503aa4 | |
parent | a0366fde4cadbdce03540c683611587dbcfb3c48 (diff) | |
download | busybox-w32-d78bd61e556d8cd728414b553edf3ccd30580b4d.tar.gz busybox-w32-d78bd61e556d8cd728414b553edf3ccd30580b4d.tar.bz2 busybox-w32-d78bd61e556d8cd728414b553edf3ccd30580b4d.zip |
ash: display job id and pid of background commands
Several common shells display the job id and pid of background
commands. Even the Unix V7 Bourne shell displays the pid.
This is unrelated to whether job control is available or enabled.
-rw-r--r-- | shell/ash.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c index f211df83a..3e741d7d2 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -4401,7 +4401,7 @@ set_curjob(struct job *jp, unsigned mode) | |||
4401 | } | 4401 | } |
4402 | } | 4402 | } |
4403 | 4403 | ||
4404 | #if JOBS || JOBS_WIN32 || DEBUG | 4404 | #if JOBS || ENABLE_PLATFORM_MINGW32 || DEBUG |
4405 | static int | 4405 | static int |
4406 | jobno(const struct job *jp) | 4406 | jobno(const struct job *jp) |
4407 | { | 4407 | { |
@@ -5910,6 +5910,10 @@ forkparent(struct job *jp, union node *n, int mode, HANDLE proc) | |||
5910 | if (mode == FORK_BG) { | 5910 | if (mode == FORK_BG) { |
5911 | backgndpid = pid; /* set $! */ | 5911 | backgndpid = pid; /* set $! */ |
5912 | set_curjob(jp, CUR_RUNNING); | 5912 | set_curjob(jp, CUR_RUNNING); |
5913 | #if ENABLE_PLATFORM_MINGW32 | ||
5914 | if (iflag && jp && jp->nprocs == 0) | ||
5915 | fprintf(stderr, "[%d] %"PID_FMT"d\n", jobno(jp), pid); | ||
5916 | #endif | ||
5913 | } | 5917 | } |
5914 | if (jp) { | 5918 | if (jp) { |
5915 | struct procstat *ps = &jp->ps[jp->nprocs++]; | 5919 | struct procstat *ps = &jp->ps[jp->nprocs++]; |