Skip to content

Commit

Permalink
Show help when connection is successful
Browse files Browse the repository at this point in the history
  • Loading branch information
jvican committed Apr 5, 2018
1 parent 9e86f14 commit 615737a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pynailgun/ng.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ def main():
try:
check_call(["java", "-jar", server_location])
except CalledProcessError as e:
print("Bloop server in %s failed to run." % target)
print("Bloop server in %s failed to run." % server_location)
print("Command: %s" % e.cmd)
print("Return code: %d" % e.returncode)
sys.exit(e.returncode)
Expand All @@ -933,15 +933,19 @@ def main():
server_port=options.nailgun_port) as c:
exit_code = c.send_command(cmd, cmd_args, options.nailgun_filearg)

if cmd == "help":
sys.stdout.write("Type `--nailgun-help` for help on the Nailgun CLI tool.\n")

sys.exit(exit_code)
except NailgunException as e:
sys.stderr.write(str(e))
if "Could not connect to" in str(e):
sys.stderr.write("\n\n")
sys.stderr.write("Have you forgotten to start bloop's server? Run it with `bloop server`.\n")
sys.stderr.write("Check our usage instructions in https://scalacenter.github.io/bloop/\n")

if cmd == "help":
sys.stdout.write("To display Nailgun's help, use `--nailgun-help`.\n")
sys.stdout.write("Type `--nailgun-help` for help on the Nailgun CLI tool.\n")
sys.exit(e.code)
except KeyboardInterrupt as e:
pass
Expand Down

0 comments on commit 615737a

Please sign in to comment.