diff options
author | Ludovic Courtès <ludo@gnu.org> | 2014-05-27 23:19:49 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2014-05-27 23:19:49 +0200 |
commit | af018f5e0a1b7c67e9f40ca68929bd35b94206d3 (patch) | |
tree | 8c3efe66f8ac1f6178357937c0a41c6f5ff8f0f8 /nix/scripts/list-runtime-roots.in | |
parent | d84a7be6675bd647931d8eff9134d00dd5a6bd58 (diff) | |
parent | 35066aa596931ef84922298c2760ceba69940cd1 (diff) | |
download | guix-af018f5e0a1b7c67e9f40ca68929bd35b94206d3.tar guix-af018f5e0a1b7c67e9f40ca68929bd35b94206d3.tar.gz |
Merge branch 'master' into core-updates
Diffstat (limited to 'nix/scripts/list-runtime-roots.in')
-rw-r--r-- | nix/scripts/list-runtime-roots.in | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/nix/scripts/list-runtime-roots.in b/nix/scripts/list-runtime-roots.in index 4d329c5ff5..993eb169c1 100644 --- a/nix/scripts/list-runtime-roots.in +++ b/nix/scripts/list-runtime-roots.in @@ -1,7 +1,7 @@ #!@GUILE@ -ds !# ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -109,9 +109,27 @@ or the empty list." (define (lsof-roots) "Return the list of roots as found by calling `lsof'." - (catch 'system + (define parent (getpid)) + + (catch 'system-error (lambda () - (let ((pipe (open-pipe* OPEN_READ "lsof" "-n" "-w" "-F" "n"))) + (let ((pipe (catch 'system-error + (lambda () + (open-pipe* OPEN_READ "lsof" "-n" "-w" "-F" "n")) + (lambda args + ;; In Guile 2.0.5, when (ice-9 popen) was still written + ;; in Scheme, 'open-pipe*' would leave the child process + ;; behind it when 'execlp' failed (that was mostly + ;; harmless though, because the uncaught exception would + ;; cause it to terminate after printing a backtrace.) + ;; Make sure that doesn't happen. + (if (= (getpid) parent) + (apply throw args) + (begin + (format (current-error-port) + "failed to execute 'lsof': ~a~%" + (strerror (system-error-errno args))) + (primitive-exit 1))))))) (define %file-rx (make-regexp "^n/(.*)$")) |