MCPcopy Create free account
hub / github.com/chen3feng/toft / Terminate

Method Terminate

system/process/sub_process.cpp:296–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294}
295
296bool SubProcess::Terminate()
297{
298 CHECK_GT(m_pid, 1) << "Invalid pid";
299
300 // First we use SIGTERM to kill the process.
301 if (kill(m_pid, SIGTERM) < 0) {
302 PLOG(ERROR) << "Unable to terminate process: " << m_pid;
303 return false;
304 }
305
306 if (TimedWaitForExit(60 * 1000))
307 return true;
308
309 // If can't terminate it graceful, kill it rudely.
310 if (kill(m_pid, SIGKILL) < 0) {
311 PLOG(ERROR) << "Unable to terminate process: " << m_pid;
312 return false;
313 }
314
315 return WaitForExit();
316}
317
318bool SubProcess::SendSignal(int signal)
319{

Callers 1

TEST_FFunction · 0.45

Calls

no outgoing calls

Tested by 1

TEST_FFunction · 0.36