I suspect you're seeing the same behavior in both cases but it just isn't obvious. ping
should return back almost instantly so probably by the time your RunApp
function gets to the end the other process is already done. cipher
on the other hand probably takes a while and so your runapp
is finished before it gets done. In either case you are not blocking until the process completes so whoever calls RunApp
is potentially running while the other process is still running in the background. If the current process is doing a lot of CPU work or writing to the console then they'll be fighting for resources.
You might consider switching to an async call and then blocking until the process completes if that is what you want to accomplish.
Note that console apps can write to the output/error stream however they want. Some processes may buffer calls until the end while others may write as they go along. You have no control over that behavior but running from the command prompt should make this obvious.