handle keyboardinterrupt, eof and blank file path in interactive ui

master
Kevin Froman 2019-06-16 01:30:17 -05:00
parent 8bbf9b10ab
commit 934602ee09
1 changed files with 7 additions and 4 deletions

View File

@ -39,8 +39,6 @@ class OnionrCLIUI:
def subCommand(self, command, args=None):
try:
#subprocess.run(["./onionr.py", command])
#subprocess.Popen(['./onionr.py', command], stdin=subprocess.STD, stdout=subprocess.STDOUT, stderr=subprocess.STDOUT)
if args != None:
subprocess.call(['./onionr.py', command, args])
else:
@ -89,7 +87,12 @@ class OnionrCLIUI:
else:
print('Plugin not enabled')
elif choice in ("3", "file sharing", "file"):
try:
filename = input("Enter full path to file: ").strip()
except (EOFError, KeyboardInterrupt) as e:
pass
else:
if len(filename.strip()) > 0:
self.subCommand("addfile", filename)
elif choice in ("4", "quit"):
showMenu = False