diff --git a/regression/goto-gcc/run_diagnostic/main.i b/regression/goto-gcc/run_diagnostic/main.i new file mode 100644 index 00000000000..f8b643afbf2 --- /dev/null +++ b/regression/goto-gcc/run_diagnostic/main.i @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/regression/goto-gcc/run_diagnostic/test.desc b/regression/goto-gcc/run_diagnostic/test.desc new file mode 100644 index 00000000000..e3a632f65f2 --- /dev/null +++ b/regression/goto-gcc/run_diagnostic/test.desc @@ -0,0 +1,10 @@ +CORE +main.i +--native-compiler /no/such/tool +^EXIT=1$ +^SIGNAL=0$ +^execvp /no/such/tool failed: No such file or directory$ +-- +^Remove failed +^warning: ignoring +^CONVERSION ERROR$ diff --git a/src/util/run.cpp b/src/util/run.cpp index f106309002e..d0fddab27fd 100644 --- a/src/util/run.cpp +++ b/src/util/run.cpp @@ -127,10 +127,13 @@ int run( dup2(stdin_fd, STDIN_FILENO); if(stdout_fd!=STDOUT_FILENO) dup2(stdout_fd, STDOUT_FILENO); + + errno=0; execvp(what.c_str(), _argv.data()); /* usually no return */ - return 1; + perror(std::string("execvp "+what+" failed").c_str()); + exit(1); } else /* fork() returns new pid to the parent process */ {