How would I go about starting a new process without it being the child of the calling process.
Example:
Main Program (Caller.exe)
process.start("file.exe")
Image:
Yes. The process creates a child, which then creates another child, becoming it's parent. You can differentiate child and parent by using fork return number.
In chrome on Windows, the child processes are in a job object and so the OS takes care of killing them when the parent process dies.
If the spawning process (parent) ends before the spawned process (child) does, then the parent-child chain is broken. To make use of this, you'd have to use an intermediate stub-process like so:
Caller.exe → Stub.exe → File.exe.
Here Stub.exe is simple launcher program that ends just after starting File.exe.
If you start a process, then you'll be its parent.
Maybe you could try to start your process from cmd.exe instead, so cmd.exe will be the parent.
Process proc = Process.Start(new ProcessStartInfo { Arguments = "/C explorer", FileName = "cmd", WindowStyle = ProcessWindowStyle.Hidden });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With