The exit code of a process terminated by Process.Kill () in C #

We have 2 processes, a parent process and a child process. The parent process controls the life cycle of the child process, that is, the parent process starts the child process when it needs the child to do some work, and also kills the child when it is done with it. To kill a child process, the parent process uses the API Process.Kill () and process.WaitForExit ().

Questions: -

  • I observe that the exit code of the child process is always -1. Who sets this exit code?

  • How can I change this exit code?

+5
source share
2 answers
  • process.kill
  • . TerminateProcess() , uExitCode.

Reflector, .

+4

, , Win32. . , Process.Kill IPC. IPC.

0

All Articles