summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhillip Smyth <phillipsmyth@codethink.co.uk>2018-01-12 12:30:02 +0000
committerJürg Billeter <j@bitron.ch>2018-02-13 06:07:43 +0100
commitb5f43ece275638b5ba4bff817ba3379dd9ae936a (patch)
tree88860f20ab84d353083f6504823cc6fa5cb92b0e
parentb6e0dd362bdd309ed74474e4a3dce9f2e3763015 (diff)
downloadbuildstream-b5f43ece275638b5ba4bff817ba3379dd9ae936a.tar.gz
_frontend/cli.py: Improve closing of non-existing workspace
Fixes #182
-rw-r--r--buildstream/_frontend/cli.py5
1 files changed, 5 insertions, 0 deletions
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)