mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
update.py: fix Ctrl+C behaviour
If the user hit Ctrl+C during the initial info gathering then it didn't break out of the loop in update.py, so you had to hit Ctrl+C for as many layers as were involved in the update. Look for exit code 254 from update_layer.py and stop if it is returned since that indicates Ctrl+C has been used. Additionally, ensure we return exit code 254 and print a message from the main update script when it is interrupted in this way. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
f5922091b4
commit
b614cba817
|
@ -337,7 +337,11 @@ def main():
|
||||||
logger.debug('Running layer update command: %s' % cmd)
|
logger.debug('Running layer update command: %s' % cmd)
|
||||||
ret, output = run_command_interruptible(cmd)
|
ret, output = run_command_interruptible(cmd)
|
||||||
logger.debug('output: %s' % output)
|
logger.debug('output: %s' % output)
|
||||||
if ret != 0:
|
if ret == 254:
|
||||||
|
# Interrupted by user, break out of loop
|
||||||
|
logger.info('Update interrupted, exiting')
|
||||||
|
sys.exit(254)
|
||||||
|
elif ret != 0:
|
||||||
continue
|
continue
|
||||||
col = re.search("^BBFILE_COLLECTIONS = \"(.*)\"", output, re.M).group(1) or ''
|
col = re.search("^BBFILE_COLLECTIONS = \"(.*)\"", output, re.M).group(1) or ''
|
||||||
ver = re.search("^LAYERVERSION = \"(.*)\"", output, re.M).group(1) or ''
|
ver = re.search("^LAYERVERSION = \"(.*)\"", output, re.M).group(1) or ''
|
||||||
|
@ -418,10 +422,14 @@ def main():
|
||||||
|
|
||||||
if ret == 254:
|
if ret == 254:
|
||||||
# Interrupted by user, break out of loop
|
# Interrupted by user, break out of loop
|
||||||
break
|
logger.info('Update interrupted, exiting')
|
||||||
|
sys.exit(254)
|
||||||
finally:
|
finally:
|
||||||
utils.unlock_file(lockfile)
|
utils.unlock_file(lockfile)
|
||||||
|
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
logger.info('Update interrupted, exiting')
|
||||||
|
sys.exit(254)
|
||||||
finally:
|
finally:
|
||||||
update.log = ''.join(listhandler.read())
|
update.log = ''.join(listhandler.read())
|
||||||
update.finished = datetime.now()
|
update.finished = datetime.now()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user