[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
20/22: install: Define new procedure pipe-cmd and use it to implement wi
From: |
John Darrington |
Subject: |
20/22: install: Define new procedure pipe-cmd and use it to implement window-pipe. |
Date: |
Tue, 27 Dec 2016 06:02:09 +0000 (UTC) |
jmd pushed a commit to branch wip-installer
in repository guix.
commit e5ce40657b4dfae60bbe301edb1df3e4a0ec9624
Author: John Darrington <address@hidden>
Date: Mon Dec 26 15:22:12 2016 +0100
install: Define new procedure pipe-cmd and use it to implement window-pipe.
* gnu/system/installer/utils.scm (pipe-cmd): New procedure. (window-pipe)
reimplement.
---
gnu/system/installer/utils.scm | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/gnu/system/installer/utils.scm b/gnu/system/installer/utils.scm
index 5ea4964..b8e257d 100644
--- a/gnu/system/installer/utils.scm
+++ b/gnu/system/installer/utils.scm
@@ -39,6 +39,7 @@
find-mount-device
window-pipe
+ pipe-cmd
N_
@@ -68,11 +69,17 @@
(define* (window-pipe win cmd #:rest args)
"Run CMD ARGS ... sending stdout and stderr to WIN. Returns the exit status
of CMD."
- (let* ((windowp (make-window-port win))
+ (let* ((windowp (make-window-port win)))
+ (clear win)
+ (apply pipe-cmd windowp cmd args)
+ (close-port windowp)))
+
+(define* (pipe-cmd ipipe cmd #:rest args)
+ "Run CMD ARGS ... sending stdout and stderr to IPIPE. Returns the exit
status of CMD."
+ (let* (
(pipep (pipe))
(pid (primitive-fork)))
- (clear win)
(if (zero? pid)
(begin
(redirect-port (cdr pipep) (current-output-port))
@@ -81,11 +88,10 @@
(begin
(close (cdr pipep))
(let loop ((c (read-char (car pipep))))
- (if (not (eof-object? c))
- (begin
- (display c windowp)
- (force-output windowp)
- (loop (read-char (car pipep))))))))
+ (unless (eof-object? c)
+ (display c ipipe)
+ (force-output ipipe)
+ (loop (read-char (car pipep)))))))
(cdr (waitpid pid))))
- 01/22: installer: Return slurped lines in their correct order., (continued)
- 01/22: installer: Return slurped lines in their correct order., John Darrington, 2016/12/27
- 15/22: installer: Remove ad-hoc completed predicate and use standard one., John Darrington, 2016/12/27
- 02/22: installer: Fix incorrect host in ping task., John Darrington, 2016/12/27
- 06/22: installer: Connect ethernet interfaces on selection., John Darrington, 2016/12/27
- 14/22: installer: Make minumum-store-size variable global., John Darrington, 2016/12/27
- 04/22: installer: Use a cleaner way of generating the lspci information., John Darrington, 2016/12/27
- 16/22: installer: Improve dependencies on the final task., John Darrington, 2016/12/27
- 22/22: gnu: Add guix to the path environment for the guix-installer service., John Darrington, 2016/12/27
- 09/22: installer: Add a variable to represent the minimum recommended store size., John Darrington, 2016/12/27
- 17/22: installer: Replace some instances of "car"., John Darrington, 2016/12/27
- 20/22: install: Define new procedure pipe-cmd and use it to implement window-pipe.,
John Darrington <=
- 03/22: installer: Make "interfaces" return an alist., John Darrington, 2016/12/27
- 13/22: installer: Add path to mount/umount commands in installer service., John Darrington, 2016/12/27
- 10/22: gnu: Add service to start the installer in installation-os., John Darrington, 2016/12/27
- 11/22: installer: Add a task to actually call guix system init., John Darrington, 2016/12/27
- 18/22: installer: New predicate valid-hostname?, John Darrington, 2016/12/27
- 21/22: installer: Correct bugs generating the configuration., John Darrington, 2016/12/27
- 08/22: installer: Deal with partition tables which are (partially) corrupt., John Darrington, 2016/12/27
- 05/22: installer: Add a new menu to configure wireless interfaces., John Darrington, 2016/12/27
- 07/22: installer: Let the kernel know about (possibly) changed partitions., John Darrington, 2016/12/27
- 19/22: installer: Ensure that all mount-points have a file system., John Darrington, 2016/12/27