getoutput(cmd) should work in a cli environment on Mac OSX, Linux, and Windows
(cmd)
| 37 | |
| 38 | |
| 39 | def getoutput(cmd): |
| 40 | """ |
| 41 | getoutput(cmd) should work in a cli environment on Mac OSX, Linux, |
| 42 | and Windows |
| 43 | """ |
| 44 | psi = System.Diagnostics.ProcessStartInfo(cmd) |
| 45 | psi.RedirectStandardOutput = True |
| 46 | psi.RedirectStandardError = True |
| 47 | psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal |
| 48 | psi.UseShellExecute = False |
| 49 | # Start up process: |
| 50 | reg = System.Diagnostics.Process.Start(psi) |
| 51 | myOutput = reg.StandardOutput |
| 52 | output = myOutput.ReadToEnd() |
| 53 | myError = reg.StandardError |
| 54 | error = myError.ReadToEnd() |
| 55 | return output |
| 56 | |
| 57 | |
| 58 | def check_pid(pid): |
no outgoing calls
searching dependent graphs…