linux-container: Work around EBADF errors upon exit.
Typically 'read-pid-file/container' would fail when starting services in containers such as BitlBee. * gnu/build/linux-container.scm (call-with-clean-exit): Use 'primitive-_exit' instead of 'primitive-exit'. (container-excursion*): Close OUT.
This commit is contained in:
parent
92423868bc
commit
95aa64bc48
|
@ -1,6 +1,6 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2015 David Thompson <davet@gnu.org>
|
;;; Copyright © 2015 David Thompson <davet@gnu.org>
|
||||||
;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2017, 2018 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -61,9 +61,14 @@ exists."
|
||||||
(const #t)
|
(const #t)
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(thunk)
|
(thunk)
|
||||||
(primitive-exit 0))
|
|
||||||
|
;; XXX: Somehow we sometimes get EBADF from write(2) or close(2) upon
|
||||||
|
;; exit (coming from fd finalizers) when used by the Shepherd. To work
|
||||||
|
;; around that, exit forcefully so fd finalizers don't have a chance to
|
||||||
|
;; run and fail.
|
||||||
|
(primitive-_exit 0))
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(primitive-exit 1))))
|
(primitive-_exit 1))))
|
||||||
|
|
||||||
(define (purify-environment)
|
(define (purify-environment)
|
||||||
"Unset all environment variables."
|
"Unset all environment variables."
|
||||||
|
@ -335,7 +340,8 @@ return the exit status."
|
||||||
(match (container-excursion pid
|
(match (container-excursion pid
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(close-port in)
|
(close-port in)
|
||||||
(write (thunk) out)))
|
(write (thunk) out)
|
||||||
|
(close-port out)))
|
||||||
(0
|
(0
|
||||||
(close-port out)
|
(close-port out)
|
||||||
(let ((result (read in)))
|
(let ((result (read in)))
|
||||||
|
|
Loading…
Reference in New Issue