mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-02-24 11:51:19 +01:00
22913: set $! on "bg"
This commit is contained in:
parent
3292f9ec1f
commit
ff9f2bb88e
3 changed files with 20 additions and 3 deletions
|
@ -1,3 +1,7 @@
|
|||
2006-10-30 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 22913: Doc/Zsh/params.yo, Src/jobs.c: set $! after a "bg", too.
|
||||
|
||||
2006-10-27 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* unposted: Completion/Unix/Command/_perforce: completion
|
||||
|
|
|
@ -477,7 +477,8 @@ The following parameters are automatically set by the shell:
|
|||
startitem()
|
||||
vindex(!)
|
||||
item(tt(!) <S>)(
|
||||
The process ID of the last background command invoked.
|
||||
The process ID of the last command started in the background with tt(&),
|
||||
or put into the background with the tt(bg) builtin.
|
||||
)
|
||||
vindex(#)
|
||||
item(tt(#) <S>)(
|
||||
|
|
16
Src/jobs.c
16
Src/jobs.c
|
@ -1789,9 +1789,21 @@ bin_fg(char *name, char **argv, Options ops, int func)
|
|||
case BIN_WAIT:
|
||||
if (func == BIN_BG)
|
||||
jobtab[job].stat |= STAT_NOSTTY;
|
||||
if ((stopped = (jobtab[job].stat & STAT_STOPPED)))
|
||||
if ((stopped = (jobtab[job].stat & STAT_STOPPED))) {
|
||||
makerunning(jobtab + job);
|
||||
else if (func == BIN_BG) {
|
||||
if (func == BIN_BG) {
|
||||
/* Set $! to indicate this was backgrounded */
|
||||
Process pn = jobtab[job].procs;
|
||||
for (;;) {
|
||||
Process next = pn->next;
|
||||
if (!next) {
|
||||
lastpid = (zlong) pn->pid;
|
||||
break;
|
||||
}
|
||||
pn = next;
|
||||
}
|
||||
}
|
||||
} else if (func == BIN_BG) {
|
||||
/* Silly to bg a job already running. */
|
||||
zwarnnam(name, "job already in background");
|
||||
thisjob = ocj;
|
||||
|
|
Loading…
Reference in a new issue