diff options
author | Ron Yorston <rmy@pobox.com> | 2021-09-26 08:59:03 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-09-26 08:59:03 +0100 |
commit | e19dd7d618434be1336727a5113c1432ac3c6573 (patch) | |
tree | e8b0c1f7a73352004e9ede35524219b692df0f1c /shell | |
parent | 1403d81c4ad4531187644005fa73789d0f7cb606 (diff) | |
download | busybox-w32-e19dd7d618434be1336727a5113c1432ac3c6573.tar.gz busybox-w32-e19dd7d618434be1336727a5113c1432ac3c6573.tar.bz2 busybox-w32-e19dd7d618434be1336727a5113c1432ac3c6573.zip |
ash: prevent exit if background jobs are present
If the user exits from an interactive shell while background jobs
are running the console window won't terminate because the
background jobs are still connected to it.
Warn the user when this happens. They can either shut down the
background jobs themselves or close the console window.
This is implemented by repurposing the stoppedjobs() function
which is otherwise unused in the WIN32 port.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c index 9f60b4350..0fa3d4dab 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -6077,7 +6077,15 @@ stoppedjobs(void) | |||
6077 | return retval; | 6077 | return retval; |
6078 | } | 6078 | } |
6079 | #else | 6079 | #else |
6080 | # define stoppedjobs() 0 | 6080 | static int |
6081 | stoppedjobs(void) | ||
6082 | { | ||
6083 | if (iflag && curjob) { | ||
6084 | out2str("You have background jobs.\n"); | ||
6085 | return 1; | ||
6086 | } | ||
6087 | return 0; | ||
6088 | } | ||
6081 | #endif | 6089 | #endif |
6082 | 6090 | ||
6083 | 6091 | ||