getoutput(cmd) should work in a cli environment on Mac OSX, Linux, and Windows
(cmd)
| 45 | reg = System.Diagnostics.Process.Start(psi) |
| 46 | |
| 47 | def getoutput(cmd): |
| 48 | """ |
| 49 | getoutput(cmd) should work in a cli environment on Mac OSX, Linux, |
| 50 | and Windows |
| 51 | """ |
| 52 | psi = System.Diagnostics.ProcessStartInfo(cmd) |
| 53 | psi.RedirectStandardOutput = True |
| 54 | psi.RedirectStandardError = True |
| 55 | psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal |
| 56 | psi.UseShellExecute = False |
| 57 | # Start up process: |
| 58 | reg = System.Diagnostics.Process.Start(psi) |
| 59 | myOutput = reg.StandardOutput |
| 60 | output = myOutput.ReadToEnd() |
| 61 | myError = reg.StandardError |
| 62 | error = myError.ReadToEnd() |
| 63 | return output |
| 64 | |
| 65 | def check_pid(pid): |
| 66 | """ |
no outgoing calls