From: Donghoon Shin Date: Wed, 21 Sep 2016 22:31:39 +0000 (+0900) Subject: Update cmd_rm.py : Ask user to confirm and add more exception handler X-Git-Tag: 0.3.3~14^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cb0547411aa372d00e86afacdf30290e1e4891a9;p=tools%2Flitmus.git Update cmd_rm.py : Ask user to confirm and add more exception handler --- diff --git a/litmus/cmds/cmd_rm.py b/litmus/cmds/cmd_rm.py index 1321f9d..ca0d636 100755 --- a/litmus/cmds/cmd_rm.py +++ b/litmus/cmds/cmd_rm.py @@ -24,8 +24,17 @@ def main(args): configparser.read(args.projects) if args.project in configparser.sections(): + + yn = input('Do you really want to remove {0}? (y/N) ' + .format(args.project)) + if not yn or yn.capitalize().startswith('N'): + return + path = configparser.get(args.project, 'path') - shutil.rmtree(path) + try: + shutil.rmtree(path) + except FileNotFoundError: + logging.debug('{0} does not exists'.format(path)) configparser.remove_section(args.project) with open(args.projects, 'w') as f: