aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-09-26 08:59:03 +0100
committerRon Yorston <rmy@pobox.com>2021-09-26 08:59:03 +0100
commite19dd7d618434be1336727a5113c1432ac3c6573 (patch)
treee8b0c1f7a73352004e9ede35524219b692df0f1c /shell
parent1403d81c4ad4531187644005fa73789d0f7cb606 (diff)
downloadbusybox-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.c10
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 6080static int
6081stoppedjobs(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