Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow "cylc graph --help" in absence of X environment. #2247

Merged
merged 1 commit into from
May 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion bin/cylc-graph
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,12 @@ try:
from xdot import DotWindow
from cylc.cylc_xdot import (
MyDotWindow, MyDotWindow2, get_reference_from_plain_format)
except ImportError as exc:
except (ImportError, RuntimeError) as exc:
# Allow command help generation without a graphical environment.
print >> sys.stderr, 'WARNING: no X environment? %s' % exc
no_x = True
else:
no_x = False

if remrun().execute():
sys.exit(0)
Expand Down Expand Up @@ -204,6 +207,9 @@ def main():

(options, args) = parser.parse_args()

if no_x:
sys.exit(1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just return/sys.exit(0) if --help is used? Doesn't seem like it should be a non-zero exit code as its successfully printing help details...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--help causes the script to exit before this point... and I just confirmed this really is the case by faking a gtk ImportError.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, good to go then


if options.filename:
if len(args) != 0:
parser.error(
Expand Down