diff options
author | jilles <jilles@FreeBSD.org> | 2009-06-13 21:17:45 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2009-06-13 21:17:45 +0000 |
commit | 884d344808b868ba1813aabf798a590a5a99683a (patch) | |
tree | 1ba6a6bdd17a2f3f559156b067a6e4ca4fb08707 /bin/sh/eval.h | |
parent | 7decb9c312312e3869ccb7439115644dc95ed665 (diff) | |
download | FreeBSD-src-884d344808b868ba1813aabf798a590a5a99683a.zip FreeBSD-src-884d344808b868ba1813aabf798a590a5a99683a.tar.gz |
Avoid leaving unnecessary waiting shells in many forms of sh -c COMMAND.
This change only affects strings passed to -c, when the -s
option is not used.
The approach is to check if there may be additional data
in the string after parsing each command. If there is none,
use the EV_EXIT flag so that a fork may be omitted in
specific cases.
If there are empty lines after the command, the check will
not see the end and forks will not be omitted. The same
thing seems to happen in bash.
Example:
sh -c 'ps lT'
No longer shows a shell process waiting for ps to finish.
PR: bin/113860
Reviewed by: stefanf
Approved by: ed (mentor)
Diffstat (limited to 'bin/sh/eval.h')
-rw-r--r-- | bin/sh/eval.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/sh/eval.h b/bin/sh/eval.h index 11f7470..c82585e 100644 --- a/bin/sh/eval.h +++ b/bin/sh/eval.h @@ -45,6 +45,11 @@ struct backcmd { /* result of evalbackcmd */ struct job *jp; /* job structure for command */ }; +/* flags in argument to evaltree/evalstring */ +#define EV_EXIT 01 /* exit after evaluating tree */ +#define EV_TESTED 02 /* exit status is checked; ignore -e flag */ +#define EV_BACKCMD 04 /* command executing within back quotes */ + int evalcmd(int, char **); void evalstring(char *, int); union node; /* BLETCH for ansi C */ |