diff --git a/cmdstanpy/model.py b/cmdstanpy/model.py index 3335d216..2a740d7b 100644 --- a/cmdstanpy/model.py +++ b/cmdstanpy/model.py @@ -54,7 +54,6 @@ cmdstan_version_before, do_command, get_logger, - returncode_msg, ) from cmdstanpy.utils.filesystem import ( temp_inits, @@ -2162,14 +2161,13 @@ def _timer_target() -> None: get_logger().info('%s done processing', logger_prefix) if retcode != 0: - retcode_summary = returncode_msg(retcode) serror = '' try: serror = os.strerror(retcode) except (ArithmeticError, ValueError): pass get_logger().error( - '%s error: %s %s', logger_prefix, retcode_summary, serror + "%s error: code '%d' %s", logger_prefix, retcode, serror ) @staticmethod diff --git a/cmdstanpy/utils/__init__.py b/cmdstanpy/utils/__init__.py index 570c4f9a..d4de6e0f 100644 --- a/cmdstanpy/utils/__init__.py +++ b/cmdstanpy/utils/__init__.py @@ -20,7 +20,7 @@ validate_dir, wrap_url_progress_hook, ) -from .command import do_command, returncode_msg +from .command import do_command from .data_munging import build_xarray_data, flatten_chains from .filesystem import ( SanitizedOrTmpFilePath, @@ -114,7 +114,6 @@ def show_versions(output: bool = True) -> str: 'parse_rdump_value', 'pushd', 'read_metric', - 'returncode_msg', 'rload', 'set_cmdstan_path', 'set_make_env', diff --git a/cmdstanpy/utils/command.py b/cmdstanpy/utils/command.py index 99380625..6f3568a6 100644 --- a/cmdstanpy/utils/command.py +++ b/cmdstanpy/utils/command.py @@ -71,25 +71,10 @@ def do_command( serror = os.strerror(proc.returncode) except (ArithmeticError, ValueError): pass - msg = 'Command {}\n\t{} {}'.format( - cmd, returncode_msg(proc.returncode), serror + msg = "Command {}\n\texited with code '{}' {}".format( + cmd, proc.returncode, serror ) raise RuntimeError(msg) except OSError as e: msg = 'Command: {}\nfailed with error {}\n'.format(cmd, str(e)) raise RuntimeError(msg) from e - - -def returncode_msg(retcode: int) -> str: - """interpret retcode""" - if retcode < 0: - sig = -1 * retcode - return f'terminated by signal {sig}' - if retcode <= 125: - return 'error during processing' - if retcode == 126: # shouldn't happen - return '' - if retcode == 127: - return 'program not found' - sig = retcode - 128 - return f'terminated by signal {sig}'