diff options
author | Ludovic Courtès <ludo@gnu.org> | 2022-05-20 17:12:01 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2022-05-20 18:46:07 +0200 |
commit | a4994d739306abcf3f36706012fb88b35a970e6b (patch) | |
tree | e348700851cfc37bd405f1ddb68fe57e89475702 /tests | |
parent | 102e3833601b75e019acb6c0d96dc2ed68b947cb (diff) | |
download | guix-a4994d739306abcf3f36706012fb88b35a970e6b.tar.gz |
inferior: Close duplicate socketpair file descriptor.
* guix/inferior.scm (open-bidirectional-pipe): Pass SOCK_CLOEXEC to 'socketpair'. * tests/inferior.scm ("close-inferior"): Add test.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/inferior.scm | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/inferior.scm b/tests/inferior.scm index 9992077cb2..56b2fcb7bc 100644 --- a/tests/inferior.scm +++ b/tests/inferior.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2018-2022 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -62,6 +62,20 @@ (close-inferior inferior) (list a (inferior-object? b)))))) +(test-equal "close-inferior" + '((hello) (world)) + (let* ((inferior1 (open-inferior %top-builddir #:command "scripts/guix")) + (lst1 (inferior-eval '(list 'hello) inferior1)) + (inferior2 (open-inferior %top-builddir #:command "scripts/guix")) + (lst2 (inferior-eval '(list 'world) inferior2))) + ;; This call succeeds if and only if INFERIOR2 does not also hold a file + ;; descriptor to the socketpair beneath INFERIOR1; otherwise it blocks. + ;; See <https://issues.guix.gnu.org/55441#10>. + (close-inferior inferior1) + + (close-inferior inferior2) + (list lst1 lst2))) + (test-equal "&inferior-exception" '(a b c d) (let ((inferior (open-inferior %top-builddir |