Skip to content

Commit

Permalink
deal with deprecated keyboardinterrupt better
Browse files Browse the repository at this point in the history
  • Loading branch information
scottgigante committed Aug 31, 2017
1 parent 41d89e2 commit 0cd670e
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions picopore/parse_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,23 @@

def checkDeprecatedArgs():
args = sys.argv[1:]
if "--realtime" in args:
args.remove('--realtime')
args = ['picopore-realtime'] + args
warnings.warn("picopore --realtime will be deprecated in 1.3.0. Use picopore-realtime instead.",FutureWarning)
elif "--test" in args:
args.remove('--test')
args = ['picopore-test'] + args
warnings.warn("picopore --test will be deprecated in 1.3.0. Use picopore-test instead.",FutureWarning)
else:
return
p = subprocess.Popen(args)
try:
if "--realtime" in args:
args.remove('--realtime')
warnings.warn("picopore --realtime will be deprecated in 1.3.0. Use picopore-realtime instead.",FutureWarning)
exit(subprocess.call(['picopore-realtime'] + args))
if "--test" in args:
args.remove('--test')
warnings.warn("picopore --test will be deprecated in 1.3.0. Use picopore-test instead.",FutureWarning)
exit(subprocess.call(['picopore-test'] + args))
p.wait()
except KeyboardInterrupt:
exit(0)
p.send_signal(signal.SIGINT)
p.wait()
exit(p.returncode)

def checkInputs(args):
args.input = [os.path.abspath(i) for i in args.input]
Expand Down

0 comments on commit 0cd670e

Please sign in to comment.