Print better error message when exec fails

This commit is contained in:
Chris Kuehl 2015-09-29 10:49:08 -07:00
parent a78ac8fe23
commit d178fbaf52
2 changed files with 2 additions and 3 deletions

View file

@ -132,9 +132,8 @@ int main(int argc, char *argv[]) {
// if this point is reached, exec failed, so we should exit nonzero // if this point is reached, exec failed, so we should exit nonzero
fprintf( fprintf(
stderr, stderr,
"Failed to launch process '%s' (errno %d: %s)\n", "dumb-init: %s: %s\n",
argv[1], argv[1],
errno,
strerror(errno) strerror(errno)
); );
exit(2); exit(2);

View file

@ -131,6 +131,6 @@ def test_fails_nonzero_with_bad_exec(both_debug_modes, both_setsid_modes):
proc.wait() proc.wait()
assert proc.returncode != 0 assert proc.returncode != 0
assert ( assert (
"Failed to launch process '/doesnotexist' (errno 2: No such file or directory)\n" 'dumb-init: /doesnotexist: No such file or directory\n'
in proc.stderr in proc.stderr
) )