fix(exec): fix segfault on exec failure
This commit is contained in:
parent
d41ec0e3c6
commit
b2c5aeea02
2 changed files with 4 additions and 2 deletions
|
|
@ -260,10 +260,10 @@ int exec_process(std::string const& runtime, std::vector<std::string> const& arg
|
||||||
}
|
}
|
||||||
catch(std::runtime_error& e)
|
catch(std::runtime_error& e)
|
||||||
{
|
{
|
||||||
fclose(ffd);
|
|
||||||
unlink(fifopath.c_str());
|
|
||||||
if(pid != 0)
|
if(pid != 0)
|
||||||
kill(pid, SIGINT);
|
kill(pid, SIGINT);
|
||||||
|
fclose(ffd);
|
||||||
|
unlink(fifopath.c_str());
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,8 @@ int main(int argc, char* argv[])
|
||||||
ctx = make_context(filecontents, file, parse_bash);
|
ctx = make_context(filecontents, file, parse_bash);
|
||||||
if(is_exec)
|
if(is_exec)
|
||||||
{
|
{
|
||||||
|
delete sh;
|
||||||
|
sh = nullptr;
|
||||||
args.erase(args.begin());
|
args.erase(args.begin());
|
||||||
return exec_process(shebang.substr(2), args, ctx);
|
return exec_process(shebang.substr(2), args, ctx);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue