C
C#6mo 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
natxnekOP6mo ago
like it creates a new process under the original process how can i avoid that
Angius
Angius6mo ago
You're looking for a service worker, probably
natxnek
natxnekOP6mo ago
nvm fixed it, i used process.StartInfo.UseShellExecute = true;
Angius
Angius6mo 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
natxnekOP6mo ago
well, i am technically running the same exe
HtmlCompiler
HtmlCompiler6mo ago
(so that would be a detached process)
Want results from more Discord servers?
Add your server