Commit 2a986943 authored by Luke Macken's avatar Luke Macken

Fix a traceback in the pyrasite-shell upon invalid usage (issue #39)

parent 0a5b6024
......@@ -22,11 +22,17 @@ import pyrasite
def shell():
"""Open a Python shell in a running process"""
usage = "Usage: pyrasite-shell <PID>"
if not len(sys.argv) == 2:
print("Usage: pyrasite-shell <PID>")
print(usage)
sys.exit(1)
try:
pid = int(sys.argv[1])
except ValueError:
print(usage)
sys.exit(1)
ipc = pyrasite.PyrasiteIPC(int(sys.argv[1]), 'ReversePythonShell')
ipc = pyrasite.PyrasiteIPC(pid, 'ReversePythonShell')
ipc.connect()
print("Pyrasite Shell %s" % pyrasite.__version__)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment