diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2018-02-12 15:46:44 +1300 |
---|---|---|
committer | Paul Eggleton <paul.eggleton@linux.intel.com> | 2018-02-20 15:59:37 +1300 |
commit | b614cba8174c97461460f7c6d0437704631420b2 (patch) | |
tree | 5df77ab1645d95a0072c4a9d98312cc4f7953b8a /layerindex/update.py | |
parent | f5922091b4c8b888849df158548453b73f92a377 (diff) | |
download | openembedded-core-contrib-b614cba8174c97461460f7c6d0437704631420b2.tar.gz openembedded-core-contrib-b614cba8174c97461460f7c6d0437704631420b2.tar.bz2 openembedded-core-contrib-b614cba8174c97461460f7c6d0437704631420b2.zip |
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>
Diffstat (limited to 'layerindex/update.py')
-rwxr-xr-x | layerindex/update.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/layerindex/update.py b/layerindex/update.py index 5c83b00a73..f60b943cb2 100755 --- a/layerindex/update.py +++ b/layerindex/update.py @@ -337,7 +337,11 @@ def main(): logger.debug('Running layer update command: %s' % cmd) ret, output = run_command_interruptible(cmd) 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 col = re.search("^BBFILE_COLLECTIONS = \"(.*)\"", 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: # Interrupted by user, break out of loop - break + logger.info('Update interrupted, exiting') + sys.exit(254) finally: utils.unlock_file(lockfile) + except KeyboardInterrupt: + logger.info('Update interrupted, exiting') + sys.exit(254) finally: update.log = ''.join(listhandler.read()) update.finished = datetime.now() |