C
C#3mo ago
MrScopes

Process not spawning as a child

My ffmpeg process spawns, but it's not as a child of the main console application
c#
var process = new Process();
process.StartInfo.FileName = "ffmpeg";
process.StartInfo.Arguments = "";
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = false;

...

process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
c#
var process = new Process();
process.StartInfo.FileName = "ffmpeg";
process.StartInfo.Arguments = "";
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = false;

...

process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
the process works perfectly and the main app can read the ffmpeg process fine, but I want it to be a child of the main application instead of it having a separate process on it's own
6 Replies
jcotton42
jcotton423mo ago
@MrScopes wdym "not a child"?
MrScopes
MrScopes3mo ago
it's a new task instead of under the main app so if I close the main program it won't stop it without me killing it manually
jcotton42
jcotton423mo ago
ah
MrScopes
MrScopes3mo ago
and in task manager it's not under the app
MrScopes
MrScopes3mo ago
like this
No description
wasabi
wasabi2mo ago
There's not really a real process hierarchy in windows. The best you get is that each process maintains the PID of the process that creates it, but that is used for nothing. If you want processes to die in response to their parents, you need to use a Job.
Want results from more Discord servers?
Add your server