c# - How can I tell when .Net System.Diagnostics.Process ran successfully or failed? -


i'm writing scheduler or sorts. it's table list of exes (like "c:\a.exe") , console app looks @ records in table every minute or , runs tasks haven't been run yet.

i run tasks this:

system.diagnostics.process p = new system.diagnostics.process(); p.startinfo.useshellexecute = false; p.startinfo.filename = someexe; // "a.exe" p.start(); 

how can tell if particular task failed? example if a.exe throws unhandled exception? i'd above code know when happens , update tasks table "the particular task failed" etc.

how can this?

i'm not using sql agent or windows scheduler because else told me not to. has more "experience" i'm following orders. feel free suggest alternatives.

you can catch win32exception check if process.start() failed due file not existing or execute access denied.

but can not catch exceptions thrown processes create using class. in first place, application might not written in .net there might not concept of exception @ all.

what can check on exitcode of application or read standardoutput , standarderror streams check whether error messages being posted.


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -