summaryrefslogtreecommitdiff
path: root/src/execline/loopwhilex.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/execline/loopwhilex.c')
-rw-r--r--src/execline/loopwhilex.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/execline/loopwhilex.c b/src/execline/loopwhilex.c
index 93a71e0..5add5e5 100644
--- a/src/execline/loopwhilex.c
+++ b/src/execline/loopwhilex.c
@@ -1,5 +1,7 @@
/* ISC license. */
+#include <errno.h>
+
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/types.h>
@@ -58,7 +60,12 @@ int main (int argc, char const *const *argv, char const *const *envp)
while (cont)
{
pid_t pid = el_spawn0(argv[0], argv, envp) ;
- if (!pid) strerr_diefu2sys(111, "spawn ", argv[0]) ;
+ if (!pid)
+ {
+ if (errno == ENOENT && argv[0][0] == ' ')
+ strerr_diefu3x(111, "spawn ", argv[0], ": name begins with a space, are you trying to spawn a block as your loop body?") ;
+ else strerr_diefu2sys(111, "spawn ", argv[0]) ;
+ }
if (wait_pid(pid, &wstat) < 0) strerr_diefu1sys(111, "wait_pid") ;
cont = not != isok(okcodes, nbc, wait_estatus(wstat)) ;
}