From b5f43ece275638b5ba4bff817ba3379dd9ae936a Mon Sep 17 00:00:00 2001 From: Phillip Smyth Date: Fri, 12 Jan 2018 12:30:02 +0000 Subject: _frontend/cli.py: Improve closing of non-existing workspace Fixes #182 --- buildstream/_frontend/cli.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/buildstream/_frontend/cli.py b/buildstream/_frontend/cli.py index 512966b8b..8678e8228 100644 --- a/buildstream/_frontend/cli.py +++ b/buildstream/_frontend/cli.py @@ -618,6 +618,11 @@ def workspace_close(app, remove_dir, element): """Close a workspace""" app.initialize((element,)) + + if app.pipeline.project._get_workspace(app.pipeline.targets[0].name) is None: + click.echo("ERROR: Workspace '{}' does not exist".format(element), err=True) + sys.exit(-1) + if app.interactive and remove_dir: if not click.confirm('This will remove all your changes, are you sure?'): click.echo('Aborting', err=True) -- cgit v1.2.1