diff --git a/src/exec.cpp b/src/exec.cpp index 2521517..ff3f20d 100644 --- a/src/exec.cpp +++ b/src/exec.cpp @@ -260,10 +260,10 @@ int exec_process(std::string const& runtime, std::vector const& arg } catch(std::runtime_error& e) { - fclose(ffd); - unlink(fifopath.c_str()); if(pid != 0) kill(pid, SIGINT); + fclose(ffd); + unlink(fifopath.c_str()); throw e; } diff --git a/src/main.cpp b/src/main.cpp index 665df43..94f83b9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -139,6 +139,8 @@ int main(int argc, char* argv[]) ctx = make_context(filecontents, file, parse_bash); if(is_exec) { + delete sh; + sh = nullptr; args.erase(args.begin()); return exec_process(shebang.substr(2), args, ctx); }