Skip to content

Commit 7fe0549

Browse files
committed
corelens: nice error when output is not writable
Reported-by: John Sobecki <[email protected]> Signed-off-by: Stephen Brennan <[email protected]>
1 parent 52ea908 commit 7fe0549

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drgn_tools/corelens.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,10 @@ def _do_main() -> None:
750750
deferred_output: List[str] = []
751751
if args.output_directory:
752752
out_dir = Path(args.output_directory)
753-
out_dir.mkdir(exist_ok=True)
753+
try:
754+
out_dir.mkdir(exist_ok=True)
755+
except OSError as e:
756+
sys.exit(f"error creating output directory: {e}")
754757
err_file = (out_dir / "corelens").open("w")
755758

756759
def info_msg(*args, **kwargs):

0 commit comments

Comments
 (0)