fix: better traceback when cwd path doesn't exist
This commit is contained in:
parent
0c7191d050
commit
4c18fe5089
1 changed files with 5 additions and 2 deletions
|
@ -129,7 +129,7 @@ def wget(url: str, path: Optional[str] = None) -> str:
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
||||||
def exec(*args: str, quiet: bool = False, cwd: str | None = None) -> bool:
|
def exec(*args: str, quiet: bool = False, cwd: Optional[str] = None) -> bool:
|
||||||
_logger.debug(f"Executing {args}")
|
_logger.debug(f"Executing {args}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -147,7 +147,10 @@ def exec(*args: str, quiet: bool = False, cwd: str | None = None) -> bool:
|
||||||
_logger.debug(proc.stderr.decode("utf-8"))
|
_logger.debug(proc.stderr.decode("utf-8"))
|
||||||
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
raise RuntimeError(f"{args[0]}: Command not found")
|
if cwd and not os.path.exists(cwd):
|
||||||
|
raise RuntimeError(f"{cwd}: No such file or directory")
|
||||||
|
else:
|
||||||
|
raise RuntimeError(f"{args[0]}: Command not found")
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise RuntimeError(f"{args[0]}: Interrupted")
|
raise RuntimeError(f"{args[0]}: Interrupted")
|
||||||
|
|
Loading…
Add table
Reference in a new issue