diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2021-02-11 17:01:39 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2021-02-11 17:01:39 +0000 |
commit | 6ff749e62652103b3ab84ef145691602ed6e0fea (patch) | |
tree | 330321dc11eda7925cd24cd276ab620f432c94cd /src/execline/loopwhilex.c | |
parent | f3486929d0e96e369a91d68893531b7d8aff1f00 (diff) | |
download | execline-6ff749e62652103b3ab84ef145691602ed6e0fea.tar.xz |
Add helpful error messages on loopwhilex { block } (and ifte too)
Diffstat (limited to 'src/execline/loopwhilex.c')
-rw-r--r-- | src/execline/loopwhilex.c | 9 |
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)) ; } |