Skip to content
Snippets Groups Projects
Commit 012e659f authored by George Nachman's avatar George Nachman
Browse files

When exec fails show the command, why it failed, and if it failed because the...

When exec fails show the command, why it failed, and if it failed because the file wasn't found, show the PATH that was searched
parent 37d120d3
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -7,6 +7,7 @@
#include "shell_launcher.h"
#include <err.h>
#include <errno.h>
#include <paths.h>
#include <sys/msg.h>
#include <stdlib.h>
#include <string.h>
Loading
Loading
@@ -66,6 +67,11 @@ static void ExecChild(int argc, char *const *argv) {
 
// TODO: The first arg should be just the last path component.
execvp(argv[0], argv);
int error = errno;
printf("Failed to exec %s: %s\n", argv[0], strerror(errno));
if (error == ENOENT) {
printf("PATH=%s\n", getenv("PATH") ?: _PATH_DEFPATH);
}
}
 
static void CreateProcessGroup() {
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment