4
0
mirror of https://github.com/nerfstudio-project/nerfstudio.git synced 2026-11-11 18:44:21 +08:00

Update error handling in data processing script

This commit is contained in:
Matt Tancik 2022-09-14 08:59:10 -07:00
parent 587e641884
commit 65ab15b5ce

View File

@ -78,9 +78,12 @@ def run_command(cmd, verbose=False) -> Optional[str]:
Returns:
The output of the command if return_output is True, otherwise None.
"""
out = subprocess.run(cmd, capture_output=not verbose, shell=True, check=True)
out = subprocess.run(cmd, capture_output=not verbose, shell=True, check=False)
if out.returncode != 0:
CONSOLE.rule("[bold red] :skull: :skull: :skull: ERROR :skull: :skull: :skull: ", style="red")
CONSOLE.print(f"[bold red]Error running command: {cmd}")
CONSOLE.rule(style="red")
CONSOLE.print(out.stderr.decode("utf-8"))
sys.exit(1)
if out.stdout is not None:
return out.stdout.decode("utf-8")