| 352 | } |
| 353 | |
| 354 | void kwsysProcess_Delete(kwsysProcess* cp) |
| 355 | { |
| 356 | /* Make sure we have an instance. */ |
| 357 | if (!cp) { |
| 358 | return; |
| 359 | } |
| 360 | |
| 361 | /* If the process is executing, wait for it to finish. */ |
| 362 | if (cp->State == kwsysProcess_State_Executing) { |
| 363 | if (cp->Detached) { |
| 364 | kwsysProcess_Disown(cp); |
| 365 | } else { |
| 366 | kwsysProcess_WaitForExit(cp, 0); |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | /* Free memory. */ |
| 371 | kwsysProcess_SetCommand(cp, 0); |
| 372 | kwsysProcess_SetWorkingDirectory(cp, 0); |
| 373 | kwsysProcess_SetPipeFile(cp, kwsysProcess_Pipe_STDIN, 0); |
| 374 | kwsysProcess_SetPipeFile(cp, kwsysProcess_Pipe_STDOUT, 0); |
| 375 | kwsysProcess_SetPipeFile(cp, kwsysProcess_Pipe_STDERR, 0); |
| 376 | free(cp->CommandExitCodes); |
| 377 | free(cp->ProcessResults); |
| 378 | free(cp); |
| 379 | } |
| 380 | |
| 381 | int kwsysProcess_SetCommand(kwsysProcess* cp, char const* const* command) |
| 382 | { |
searching dependent graphs…