C
C#6d ago
natxnek

Thread when starting a process

System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = "discordbotloader.exe";
process.StartInfo.Arguments = "-bot";
process.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
process.Start();
process.WaitForExit();
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = "discordbotloader.exe";
process.StartInfo.Arguments = "-bot";
process.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
process.Start();
process.WaitForExit();
is there a way to make that process run in the background when i close the application that started the process? if i close the main console app, it also closes the new process
6 Replies
natxnek
natxnek6d ago
like it creates a new process under the original process how can i avoid that
Angius
Angius6d ago
You're looking for a service worker, probably
natxnek
natxnek6d ago
nvm fixed it, i used process.StartInfo.UseShellExecute = true;
Angius
Angius6d ago
Ah, duh, my bad I thought you're trying to create a separate task from the same code, completely missed that you're running something else. Makes sense
natxnek
natxnek6d ago
well, i am technically running the same exe
ffmpeg -i me -f null -
(so that would be a detached process)