Skip to content

Commit

Permalink
detach child process
Browse files Browse the repository at this point in the history
  • Loading branch information
iceboy233 committed Sep 1, 2019
1 parent a4fc9de commit acffc63
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
7 changes: 1 addition & 6 deletions sandbox/sandbox.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ Sandbox::Sandbox(const Options &options)
: options_(options), host_stream_(&host_streambuf_) {}

Sandbox::~Sandbox() {
// TODO(iceboy): when does nodejs destruct objects?
// TODO(iceboy): send terminate signal.
if (guest_pid_) {
waitpid(guest_pid_, nullptr, 0);
}
if (host_socket_ != -1) {
close(host_socket_);
}
Expand Down Expand Up @@ -60,7 +55,7 @@ bool Sandbox::init() {
return false;
}
close(guest_socket_);
guest_pid_ = pid;
waitpid(pid, nullptr, WNOHANG);
return true;
}

Expand Down
1 change: 0 additions & 1 deletion sandbox/sandbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class Sandbox {
std::string root_dir_;
int host_socket_ = -1;
int guest_socket_ = -1;
pid_t guest_pid_ = 0;
FdStreamBuf host_streambuf_;
std::iostream host_stream_;
};
Expand Down

0 comments on commit acffc63

Please sign in to comment.