MCPcopy Create free account
hub / github.com/geekcomputers/Python / ps

Function ps

pscheck.py:22–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20
21
22def ps():
23 program = input("Enter the name of the program to check: ")
24
25 try:
26 # perform a ps command and assign results to a list
27 output = commands.getoutput("ps -f|grep " + program)
28 proginfo = string.split(output)
29
30 # display results
31 print(
32 "\n\
33 Full path:\t\t",
34 proginfo[5],
35 "\n\
36 Owner:\t\t\t",
37 proginfo[0],
38 "\n\
39 Process ID:\t\t",
40 proginfo[1],
41 "\n\
42 Parent process ID:\t",
43 proginfo[2],
44 "\n\
45 Time started:\t\t",
46 proginfo[4],
47 )
48 except:
49 print("There was a problem with the program.")
50
51
52def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected