diff options
Diffstat (limited to 'gn3/commands.py')
| -rw-r--r-- | gn3/commands.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gn3/commands.py b/gn3/commands.py index 38153bf..51b70c3 100644 --- a/gn3/commands.py +++ b/gn3/commands.py @@ -3,6 +3,7 @@ commands""" import os import sys import json +import shlex import pickle import logging import tempfile @@ -156,7 +157,11 @@ def run_sample_corr_cmd(method, this_trait_data, target_dataset_data): def run_cmd(cmd: str, success_codes: Tuple = (0,), env: Optional[str] = None) -> Dict: """Run CMD and return the CMD's status code and output as a dict""" - parsed_cmd = json.loads(__pk__("Attempting to parse command", cmd)) + try: + parsed_cmd = json.loads(__pk__("Attempting to parse command", cmd)) + except json.decoder.JSONDecodeError as jderr: + parsed_cmd = shlex.split(cmd) + parsed_env = (json.loads(env) if env is not None else None) results = subprocess.run( |
