mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 22:31:12 +02:00
(open-process): Close input-fdes, output-fdes and
error-fdes after duping them to 0, 1 and 2.
This commit is contained in:
parent
9e1569bd0d
commit
88a63bfc10
1 changed files with 8 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
;; popen emulation, for non-stdio based ports.
|
||||
|
||||
;;;; Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
;;;; Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
|
||||
;;;;
|
||||
;;;; This library is free software; you can redistribute it and/or
|
||||
;;;; modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -90,14 +90,18 @@
|
|||
(set! output-fdes (dup->fdes 0)))
|
||||
(if (= error-fdes 0)
|
||||
(set! error-fdes (dup->fdes 0)))
|
||||
(dup2 input-fdes 0)))
|
||||
(dup2 input-fdes 0)
|
||||
(close-fdes input-fdes)))
|
||||
|
||||
(cond ((not (= output-fdes 1))
|
||||
(if (= error-fdes 1)
|
||||
(set! error-fdes (dup->fdes 1)))
|
||||
(dup2 output-fdes 1)))
|
||||
(dup2 output-fdes 1)
|
||||
(close-fdes output-fdes)))
|
||||
|
||||
(dup2 error-fdes 2)
|
||||
(cond ((not (= error-fdes 2))
|
||||
(dup2 error-fdes 2)
|
||||
(close-fdes error-fdes)))
|
||||
|
||||
(apply execlp prog prog args)))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue