tools/eclipse: remove infinite loop searching root
In case project.py is invoked with a root which is not a bazel
workspace, it will enter an infinite loop searching for `/WORKSPACE`.
exit immediately after checking `/`.
Change-Id: I2c2e892f121c935136b5449486001a85aa163b2d
diff --git a/tools/eclipse/project.py b/tools/eclipse/project.py
index cbad31e..a24266f 100755
--- a/tools/eclipse/project.py
+++ b/tools/eclipse/project.py
@@ -44,6 +44,10 @@
root = args.root
ROOT = os.path.abspath(root)
while not os.path.exists(os.path.join(ROOT, 'WORKSPACE')):
+ if ROOT == '/':
+ print('Could not find root of project: no WORKSPACE file found',
+ file=sys.stderr)
+ sys.exit(1)
ROOT = os.path.dirname(ROOT)
batch_option = '--batch' if args.batch else None