Cgi kill on destruct
This commit is contained in:
parent
bec2f37670
commit
443e5c3c3b
@ -29,6 +29,11 @@ CgiProcess::CgiProcess(const HttpRequest &request, CgiHandler &handler)
|
|||||||
spawn();
|
spawn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CgiProcess::~CgiProcess()
|
||||||
|
{
|
||||||
|
this->kill();
|
||||||
|
}
|
||||||
|
|
||||||
void CgiProcess::spawn()
|
void CgiProcess::spawn()
|
||||||
{
|
{
|
||||||
const URI &uri = request_.getUri();
|
const URI &uri = request_.getUri();
|
||||||
@ -64,10 +69,10 @@ void CgiProcess::spawn()
|
|||||||
{
|
{
|
||||||
int flags = fcntl(pipeStdin[0], F_GETFL, 0);
|
int flags = fcntl(pipeStdin[0], F_GETFL, 0);
|
||||||
fcntl(pipeStdin[0], F_SETFL, flags & ~O_NONBLOCK);
|
fcntl(pipeStdin[0], F_SETFL, flags & ~O_NONBLOCK);
|
||||||
|
|
||||||
flags = fcntl(pipeStdout[1], F_GETFL, 0);
|
flags = fcntl(pipeStdout[1], F_GETFL, 0);
|
||||||
fcntl(pipeStdout[1], F_SETFL, flags & ~O_NONBLOCK);
|
fcntl(pipeStdout[1], F_SETFL, flags & ~O_NONBLOCK);
|
||||||
|
|
||||||
flags = fcntl(pipeStderr[1], F_GETFL, 0);
|
flags = fcntl(pipeStderr[1], F_GETFL, 0);
|
||||||
fcntl(pipeStderr[1], F_SETFL, flags & ~O_NONBLOCK);
|
fcntl(pipeStderr[1], F_SETFL, flags & ~O_NONBLOCK);
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ class CgiProcess
|
|||||||
CgiProcess &operator=(const CgiProcess &other) = delete;
|
CgiProcess &operator=(const CgiProcess &other) = delete;
|
||||||
CgiProcess &operator=(CgiProcess &&other) noexcept = delete;
|
CgiProcess &operator=(CgiProcess &&other) noexcept = delete;
|
||||||
|
|
||||||
~CgiProcess() = default;
|
~CgiProcess();
|
||||||
void kill() const noexcept;
|
void kill() const noexcept;
|
||||||
void wait() noexcept;
|
void wait() noexcept;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user