I believe the
StdOut.ReadAll() alone blocks until the process finishes. So I think that if you just swap the lines as I have suggested, it should be fine.