Skip to content
Snippets Groups Projects
Commit 6c1ef363 authored by Ramin Yaghoubzadeh Torky's avatar Ramin Yaghoubzadeh Torky
Browse files

scripts: circumvented Windows not terminating scripts on Ctrl-C

parent ddc081b8
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
import logging import logging
import sys import sys
import time import time
import os
import platform
import ipaaca import ipaaca
...@@ -71,20 +73,30 @@ while len(sys.argv)>idx+1: ...@@ -71,20 +73,30 @@ while len(sys.argv)>idx+1:
pl[sys.argv[idx]] = sys.argv[idx+1] pl[sys.argv[idx]] = sys.argv[idx+1]
idx+=2 idx+=2
print "Sending "+iu_class+" of category "+cate try:
print " with payload "+str(pl) print "Sending "+iu_class+" of category "+cate
print " with payload "+str(pl)
ob = ipaaca.OutputBuffer('IUInjector') ob = ipaaca.OutputBuffer('IUInjector')
ob.register_handler(my_update_handler) ob.register_handler(my_update_handler)
iu_top = ipaaca.IU(cate) iu_top = ipaaca.IU(cate)
iu_top.payload = pl iu_top.payload = pl
ob.add(iu_top) ob.add(iu_top)
print iu_class+" sent." print iu_class+" sent."
if iu_class=="IU": if iu_class=="IU":
print "Waiting "+str(timeout)+" sec for remote modifications..." print "Waiting "+str(timeout)+" sec for remote modifications..."
time.sleep(timeout) time.sleep(timeout)
else:
time.sleep(0.1)
print "done."
except KeyboardInterrupt:
pass
if platform.system() == 'Windows':
os._exit(0)
else: else:
time.sleep(0.1) sys.exit(0)
print "done."
...@@ -36,6 +36,8 @@ import logging ...@@ -36,6 +36,8 @@ import logging
import re import re
import sys import sys
import time import time
import os
import platform
import ipaaca import ipaaca
...@@ -122,5 +124,14 @@ else: ...@@ -122,5 +124,14 @@ else:
for cat in cats: for cat in cats:
print('\t' + cat) print('\t' + cat)
print('') print('')
while True: try:
time.sleep(1) while True:
time.sleep(1)
except KeyboardInterrupt:
pass
if platform.system() == 'Windows':
os._exit(0)
else:
sys.exit(0)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment