From 6f43d14c91da544b26f1f901e7105e11c08f7d9c Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Mon, 18 Aug 2025 21:23:18 +0200 Subject: examples/unschroot_*.py: improve error message for exec failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Suggested-by: Jérémy Lal --- examples/unschroot_fs.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'examples/unschroot_fs.py') diff --git a/examples/unschroot_fs.py b/examples/unschroot_fs.py index d5f67b0..fbc9bfc 100755 --- a/examples/unschroot_fs.py +++ b/examples/unschroot_fs.py @@ -421,7 +421,13 @@ def do_run_session(args: argparse.Namespace) -> None: args.command.append("bash") # Wait until Python has handed off to Perl. os.read(rfd, 1) - os.execvp(args.command[0], args.command) + try: + os.execvp(args.command[0], args.command) + except OSError as err: + print( + f"failed to exec {args.command[0]}: {err}", file=sys.stderr + ) + os._exit(127) else: rfd.close() linuxnamespaces.prctl_set_pdeathsig(signal.SIGKILL) -- cgit v1.2.3