Skip to content

Commit

Permalink
Merge pull request #117 from UQ-PAC/aslp-cpp-exit-in-fork
Browse files Browse the repository at this point in the history
aslp-cpp: exit from forked server subprocess
  • Loading branch information
katrinafyi authored Dec 26, 2024
2 parents 552d319 + 3320c6c commit 799846c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions aslp-cpp/include/aslp-cpp/aslp-cpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class aslp_connection
class aslp_client
{
private:
const std::string server_addr;
pid_t server_pid;
const std::string server_addr;
int server_port;
void shutdown();

Expand All @@ -47,8 +47,8 @@ class aslp_client
*/
aslp_client(pid_t pid, std::string addr, int port)
: server_pid(pid)
, server_port(port)
, server_addr(std::move(addr))
, server_port(port)
{
}

Expand Down
5 changes: 3 additions & 2 deletions aslp-cpp/source/aslp-cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ auto aslp_client::start(const std::string& addr, int server_port)
auto command = std::format(
"opam exec -- aslp-server --host {} --port {}", addr, server_port);
std::cerr << command << std::endl;
std::system(command.c_str());
std::cerr << "Child process exited." << std::endl;
int retcode = std::system(command.c_str());
std::cerr << "Child process exited with code: " << retcode << std::endl;
std::exit(retcode);
return {nullptr};
}

Expand Down

0 comments on commit 799846c

Please sign in to comment.