Skip to content
Snippets Groups Projects
Commit 54f0901a authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'Process-kill-pid'


8e428c18 Process: Add function to kill process (and children) with pid

Acked-by: default avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !65
parents 6ffca34c 8e428c18
No related branches found
No related tags found
No related merge requests found
......@@ -77,6 +77,7 @@
#define kwsysProcess_WaitForExit kwsys_ns(Process_WaitForExit)
#define kwsysProcess_Interrupt kwsys_ns(Process_Interrupt)
#define kwsysProcess_Kill kwsys_ns(Process_Kill)
#define kwsysProcess_KillPID kwsys_ns(Process_KillPID)
#define kwsysProcess_ResetStartTime kwsys_ns(Process_ResetStartTime)
#endif
......@@ -456,6 +457,13 @@ kwsysEXPORT void kwsysProcess_Interrupt(kwsysProcess* cp);
*/
kwsysEXPORT void kwsysProcess_Kill(kwsysProcess* cp);
/**
* Same as kwsysProcess_Kill using process ID to locate process to
* terminate.
* @see kwsysProcess_Kill(kwsysProcess* cp)
*/
kwsysEXPORT void kwsysProcess_KillPID(unsigned long);
/**
* Reset the start time of the child process to the current time.
*/
......
......@@ -2485,6 +2485,11 @@ static pid_t kwsysProcessFork(kwsysProcess* cp,
#define KWSYSPE_PS_FORMAT "%d %d %*[^\n]\n"
#endif
void kwsysProcess_KillPID(unsigned long process_id)
{
kwsysProcessKill((pid_t)process_id);
}
static void kwsysProcessKill(pid_t process_id)
{
#if defined(__linux__) || defined(__CYGWIN__)
......
......@@ -1466,6 +1466,11 @@ void kwsysProcess_Kill(kwsysProcess* cp)
for them to exit. */
}
void kwsysProcess_KillPID(unsigned long process_id)
{
kwsysProcessKillTree((DWORD)process_id);
}
/*
Function executed for each pipe's thread. Argument is a pointer to
the kwsysProcessPipeData instance for this thread.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment