C
C#2y ago
FaNim

❔ How to wait for process to complete

i want to make program opens async but instead of giving 'hard coded' delays but i don't know how to use Process to wait for it to complete opening
26 Replies
Angius
Angius2y ago
If you have an async method, simply await it
FaNim
FaNimOP2y ago
just set process.start as await?
Angius
Angius2y ago
Ah, that's what you mean
FaNim
FaNimOP2y ago
yep
Angius
Angius2y ago
No, Process.Start is not asynchronous
FaNim
FaNimOP2y ago
ye i know but in all i mean that i want to start process and wait for it to complete run completing openning i mean
Angius
Angius2y ago
Process.WaitForExit() would be one way Process.Exited event would be another
FaNim
FaNimOP2y ago
but isnt it for when process is closing?
Angius
Angius2y ago
Well, I'd assume that the process does exit when it completes
FaNim
FaNimOP2y ago
actually no
Angius
Angius2y ago
How does that process signal completion, then?
FaNim
FaNimOP2y ago
iam making app to open as many apps as you want by one button and closing it by one button when you dont need this apps to be open it dont
Angius
Angius2y ago
Then the answer to the question in the title is "you cannot"
FaNim
FaNimOP2y ago
so how to make that signal you said about
Angius
Angius2y ago
Do you have access to the source code of whatever that other app you want to run is?
FaNim
FaNimOP2y ago
nope :/
Angius
Angius2y ago
Then you cannot
FaNim
FaNimOP2y ago
but what about that is it the java app?
Angius
Angius2y ago
Does that Java app signal completion?
FaNim
FaNimOP2y ago
actually i have no idea
ACiDCA7
ACiDCA72y ago
look, if the apps you start dont have anything implemented that give you a signal that they are open and fully initialized, you wont know if the are completely open if apps close they return a exitcode with which you would know when they are closed anything else you are out of luck if it isnt your code
FaNim
FaNimOP2y ago
okay ye i understand but there isn't any option to check for that through Process? And btw is there any good documentation or article about Process class etc?
ACiDCA7
ACiDCA72y ago
you just know that there is a process running.. will it tell you if its still alive/open/whatever? no as soon as you run process.start there will be a process but like you said, you want to know if its fully opened
FaNim
FaNimOP2y ago
hmm okay
Angius
Angius2y ago
Process Class (System.Diagnostics)
Provides access to local and remote processes and enables you to start and stop local system processes.
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server