allow ctrl+c to interrupt any subcommand

Revert "allow ctrl+c to interrupt watch-lock without printing a python stack dump"
This reverts commit bbe6d71a0a8d196bdf7a5d96f483b4df7cd3cec4.
This commit is contained in:
Josh Holtrop 2012-06-18 15:55:25 -04:00
parent c60698cd04
commit 6fd5ad2615

55
jsvn
View File

@ -576,23 +576,23 @@ def watch_lock(argv, svn, out):
break break
last_lock_owner = '' last_lock_owner = ''
try: while True:
while True: lock_owner = ''
lock_owner = '' p = Popen([svn, 'info', path], stdout=PIPE)
p = Popen([svn, 'info', path], stdout=PIPE) lines = p.communicate()[0].split('\n')
lines = p.communicate()[0].split('\n') for line in lines:
for line in lines: m = re.match(r'Lock\sOwner:\s*(.*)', line)
m = re.match(r'Lock\sOwner:\s*(.*)', line) if m is not None:
if m is not None: lock_owner = m.group(1)
lock_owner = m.group(1)
break
if lock_owner == '':
break break
if lock_owner != last_lock_owner: if lock_owner == '':
out.write('Locked by: %s\n' % lock_owner) break
last_lock_owner = lock_owner if lock_owner != last_lock_owner:
time.sleep(60) out.write('Locked by: %s\n' % lock_owner)
out.write(''' last_lock_owner = lock_owner
time.sleep(60)
out.write('''
_ _ _ _ _ _ _ _ _ _ _ _
| | | |_ __ | | ___ ___| | _____ __| | | | | | |_ __ | | ___ ___| | _____ __| | |
| | | | '_ \| |/ _ \ / __| |/ / _ \/ _` | | | | | | '_ \| |/ _ \ / __| |/ / _ \/ _` | |
@ -600,8 +600,6 @@ def watch_lock(argv, svn, out):
\___/|_| |_|_|\___/ \___|_|\_\___|\__,_(_) \___/|_| |_|_|\___/ \___|_|\_\___|\__,_(_)
''') ''')
except KeyboardInterrupt:
pass
return RET_OK return RET_OK
def users(argv, svn, out): def users(argv, svn, out):
@ -1150,16 +1148,19 @@ def main(argv):
if config['svn']: if config['svn']:
realsvn = config['svn'] realsvn = config['svn']
# set up execution environment for user-defined function aliases try:
def do(cmd, expand=True): # set up execution environment for user-defined function aliases
if type(cmd) == types.StringType: def do(cmd, expand=True):
cmd = [cmd] if type(cmd) == types.StringType:
do_cmd(cmd, realsvn, config, expand) cmd = [cmd]
config['do'] = do do_cmd(cmd, realsvn, config, expand)
config['Popen'] = Popen config['do'] = do
config['PIPE'] = PIPE config['Popen'] = Popen
config['PIPE'] = PIPE
do_cmd(argv, realsvn, config) do_cmd(argv, realsvn, config)
except KeyboardInterrupt:
pass
return 0 return 0