Skip to content

Commit c125146

Browse files
author
Daniel Kroening
authored
Merge pull request #1245 from tautschnig/run-diagnostic
Avoid zombie and print diagnostic output if run/execve fails
2 parents 435c0bf + 08a4077 commit c125146

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
int main()
2+
{
3+
return 0;
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
main.i
3+
--native-compiler /no/such/tool
4+
^EXIT=1$
5+
^SIGNAL=0$
6+
^execvp /no/such/tool failed: No such file or directory$
7+
--
8+
^Remove failed
9+
^warning: ignoring
10+
^CONVERSION ERROR$

src/util/run.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,13 @@ int run(
127127
dup2(stdin_fd, STDIN_FILENO);
128128
if(stdout_fd!=STDOUT_FILENO)
129129
dup2(stdout_fd, STDOUT_FILENO);
130+
131+
errno=0;
130132
execvp(what.c_str(), _argv.data());
131133

132134
/* usually no return */
133-
return 1;
135+
perror(std::string("execvp "+what+" failed").c_str());
136+
exit(1);
134137
}
135138
else /* fork() returns new pid to the parent process */
136139
{

0 commit comments

Comments
 (0)