From e88baf0363607d4e072f5a29a2cd01ededfa00d2 Mon Sep 17 00:00:00 2001 From: Timothy Sample Date: Sat, 15 Dec 2018 12:57:52 -0500 Subject: [PATCH] environment: Print command name on execlp error. Fixes . * guix/scripts/environment.scm: When execlp raises ENOENT, print a clear error message and exit with status 127 (like a shell would). --- guix/scripts/environment.scm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index 5965e3426..27483acb2 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -389,7 +389,15 @@ variables are cleared before setting the new ones." (create-environment profile manifest #:pure? pure?) (match command ((program . args) - (apply execlp program program args)))) + (catch 'system-error + (lambda () + (apply execlp program program args)) + (lambda args + (if (= ENOENT (system-error-errno args)) + (begin + (report-error (G_ "~a: command not found~%") program) + (exit 127)) + (apply throw args))))))) (define* (launch-environment/fork command profile manifest #:key pure?) "Run COMMAND in a new process with an environment containing PROFILE, with -- 2.20.0