diff --git a/CHANGELOG.md b/CHANGELOG.md index d4f83a87..41bbb12f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ The client here will eventually be released as "spython" (and eventually to singularity on pypi), and the versions here will coincide with these releases. ## [master](https://github.com/singularityhub/singularity-cli/tree/master) + - flexible error printing given command to terminal fails (0.0.43) - adding name_by_commit and name_by_hash to pull (0.0.42) - adding nvidia flag as nv argument (with default False) to run/exec (0.0.41) - fixing bug in shell.py, cli should be client (0.0.40) diff --git a/spython/main/base/command.py b/spython/main/base/command.py index 20efa564..d752cb0c 100644 --- a/spython/main/base/command.py +++ b/spython/main/base/command.py @@ -116,7 +116,7 @@ def run_command(self, cmd, sudo=False, capture=True): result = run_cmd(cmd, sudo=sudo, capture=capture, quiet=self.quiet) message = result['message'] return_code = result['return_code'] - + if result['return_code'] == 0: if len(message) == 1: message = message[0] diff --git a/spython/main/run.py b/spython/main/run.py index a8ce579f..4617e82d 100644 --- a/spython/main/run.py +++ b/spython/main/run.py @@ -91,10 +91,11 @@ def run(self, else: return stream_command(cmd, sudo=sudo) - result = result.strip('\n') - - try: - result = json.loads(result) - except: - pass - return result + if result: + result = result.strip('\n') + + try: + result = json.loads(result) + except: + pass + return result diff --git a/spython/version.py b/spython/version.py index 5e2cc6d1..5701ecdd 100644 --- a/spython/version.py +++ b/spython/version.py @@ -18,7 +18,7 @@ -__version__ = "0.0.42" +__version__ = "0.0.43" AUTHOR = 'Vanessa Sochat' AUTHOR_EMAIL = 'vsochat@stanford.edu' NAME = 'spython' @@ -28,4 +28,4 @@ LICENSE = "LICENSE" INSTALL_REQUIRES = ( -) \ No newline at end of file +)