From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Rutger van Beusekom Newsgroups: gmane.lisp.guile.devel Subject: Re: guile pipeline do-over Date: Tue, 10 Mar 2020 08:35:44 +0100 Message-ID: <877dzsy84v.fsf@verum.com> References: <8736al24jt.fsf@verum.com> <87imjgi2vs.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="14478"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.2.0; emacs 26.3 Cc: Guile Devel To: Ludovic =?utf-8?Q?Court=C3=A8s?= Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Tue Mar 10 08:36:36 2020 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jBZRM-0003ef-0c for guile-devel@m.gmane-mx.org; Tue, 10 Mar 2020 08:36:36 +0100 Original-Received: from localhost ([::1]:54642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBZRK-0007TB-UE for guile-devel@m.gmane-mx.org; Tue, 10 Mar 2020 03:36:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57828) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBZQe-0007T3-Fp for guile-devel@gnu.org; Tue, 10 Mar 2020 03:35:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jBZQb-0001QO-VG for guile-devel@gnu.org; Tue, 10 Mar 2020 03:35:51 -0400 Original-Received: from mail-eopbgr20109.outbound.protection.outlook.com ([40.107.2.109]:63697 helo=EUR02-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jBZQb-0001KM-EZ; Tue, 10 Mar 2020 03:35:49 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d8AiSKmKkjqQHRuc2z4VFe1FA8D3wxsi/pGMA+pPZygYcM8diMr8U/ywpWbcpA8lZ/e+DnpKZ59tMLmtQXeiGe0Sx9pFz40cpH8w11BG3IbUsTiEgceuCRzk24xqb6AT4VRbRUi1vKFFDgFS4A+BeegvxETqjxsxj8rixv/eXA8h1EDmmxOfu9SZJAj7EOTzAgY8/XkaFhY++TqxO2EMzeDO/s1PhyMXLvLY5YShrHbkZ7BI+2KxRQjWNLqmAhWbIqWb+9hEjh9N/LgllHaUly7h4ekFA7hpEQru+rj+vh6oe79qeBQQ31YCH2kSscS7Ce6hGyQ5CeNBkkv67U0Ong== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FeHp0hooC1aNYR5jnS6YWr9Funk1yhESkuEkjbBN2Ig=; b=ZMo7X/jtpUIzFWsrfGlLSYggqey3X6/ClrTGmdqA+G3cCYfhNgzrAa25lae945D+eoCV1FdLgefbm8x9khPnku4NGcaZdJ3dU/DyFUvAh0EA3/cBkTBmQHuXii4bsrRleDTYFbe6YITWuTyPvhX+LNLBz892CbNt+KQtiOpqw459NRJg6cRaQ0RfKftrW16OOgIve7W3528bKXyoNpx31xRvqKgAFrwF63vb6gYccmuqR7fkwBWUg52xPhAj1bPjv4AlMh8p5futDsLs23977FOy9pvO4tSSDRA3FFzc4ONzb5EyYDzKH23yG4DKZzPfceNc+llvvTy6OAb5Ok3lwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=verum.com; dmarc=pass action=none header.from=verum.com; dkim=pass header.d=verum.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=verumst.onmicrosoft.com; s=selector2-verumst-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FeHp0hooC1aNYR5jnS6YWr9Funk1yhESkuEkjbBN2Ig=; b=crJ3kmSLFSDOlHHI1rSX1+ZxDtm0Y4rRpdevPQdPMdAPHqjEYYwn0b1Fg8lnn5sj2t/vXHxxREKZj75wWTHLkcdYjXvDTpkU6sdZC6t8Yq3JZ2Tv4Ch5uZorQ8uzX1ZxzYOQdPrF//Lt+0lEzoih4m8ZCb4HkggvatY5wniMazg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rutger.van.beusekom@verum.com; Original-Received: from AM6PR08MB4455.eurprd08.prod.outlook.com (20.179.7.202) by AM6PR08MB4102.eurprd08.prod.outlook.com (20.179.2.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.17; Tue, 10 Mar 2020 07:35:45 +0000 Original-Received: from AM6PR08MB4455.eurprd08.prod.outlook.com ([fe80::558c:a791:d1e5:78ba]) by AM6PR08MB4455.eurprd08.prod.outlook.com ([fe80::558c:a791:d1e5:78ba%7]) with mapi id 15.20.2793.013; Tue, 10 Mar 2020 07:35:45 +0000 In-reply-to: <87imjgi2vs.fsf@gnu.org> X-ClientProxiedBy: AM0PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:208:1::16) To AM6PR08MB4455.eurprd08.prod.outlook.com (2603:10a6:20b:70::10) X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from eigen (213.127.7.185) by AM0PR0202CA0003.eurprd02.prod.outlook.com (2603:10a6:208:1::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2793.14 via Frontend Transport; Tue, 10 Mar 2020 07:35:44 +0000 X-Originating-IP: [213.127.7.185] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b26aa667-ad4e-4f4f-d823-08d7c4c5a4cb X-MS-TrafficTypeDiagnostic: AM6PR08MB4102: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 033857D0BD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(366004)(396003)(136003)(39830400003)(346002)(199004)(189003)(16526019)(478600001)(186003)(956004)(2906002)(36756003)(86362001)(26005)(81166006)(8936002)(3480700007)(2616005)(8676002)(81156014)(66616009)(5660300002)(66556008)(66946007)(52116002)(450100002)(4326008)(6496006)(33964004)(66476007)(53546011)(6916009)(30864003)(316002)(6486002)(66574012)(473944003); DIR:OUT; SFP:1102; SCL:1; SRVR:AM6PR08MB4102; H:AM6PR08MB4455.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: verum.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 700xzjnvQr5QqopK5mpx+YptaTD7G1PnBNtSRXimES6tVp6zSFu330IAXPT2cGuwOirDUIRVcV6FtbrIB/gRy0teyfWg7jA93pkTL7o/hsSumY9est+s/hKQfaAfVASxkz8wY9NyMdd2jpejpaoUhwUbzNhq9SaGYHjJNMW3KODOHwHek5oi+dg2q3bQyU/0kynRHo+LDwZLrQVdNbID8ICMt1wa6Hc2cTcKJiQ/fGLmjUvqGERN9g6x7AR3aZdV6sB7IUKcBa+i8Vr69LfnmcEb+VsJGR6vMMf8nuCWLWeeOd1BtVM8o2VkXQOAHQ8ES9rFSlMpBWYwjCcxL96d3yizpRvhNWmykkwlVj5w66xDHqD4Prlzd2KfVw9Qjk80+dsmm66yESULdeUW9Ab2gDblkCR8XA9ZVtmdx42KCK4GtssZI2UNEWUHCAT4iyk/no9pQPLl8IQ0UGmHYt5KGJo5Pr33+6wbHh7wBPPPdtpU8dhtM+wqh+LwXw9k9DGC X-MS-Exchange-AntiSpam-MessageData: g61192rA2wt6y9QYfYL+Z+uXiPT+uhgdXmLbZi1+eKHkdC3z7TFD7uzgsODC/qAXrrpYskEKQlNddp94C0DgTuDcFAVk68sM1oXyQUAy1YkOrYlAdR+vjPNdJ7XGMddvN4omVlBlvVnXJLFX2zlxVw== X-OriginatorOrg: verum.com X-MS-Exchange-CrossTenant-Network-Message-Id: b26aa667-ad4e-4f4f-d823-08d7c4c5a4cb X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2020 07:35:45.2906 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a12adc2b-ece0-4282-b9ce-ad23864dd7c5 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: u9eZ5jN9RZMlacIA89z+GUL35aZRNnbaJlZZs99j9n8jgs9lqQvHgeJ8OIj0nOQ86gDcBP4Gl+r+NCshIiy7PJElHHpjlQdD18SMZIT8fUs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4102 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.2.109 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:20441 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Ludo, I have processed your feedback in this version of the patch. Ludovic Court=C3=A8s writes: > Hi Rutger! > >> ... > Nice! That=E2=80=99s definitely very useful to have. We=E2=80=99ll need= to check what > Andy thinks, but I think it can be added in the 3.0 series. > > >> ... > Could you mention functions renamed/removed here? The ChangeLog format > is about boringly listing all the language-entity-level changes. :-) > Done. > >> ... > I guess you can remove the commented-out bits=E2=80=A6 > Yep. > >> ... > =E2=80=A6 and this hunk, to minimize change. > Check. > >> ... > I would not export =E2=80=98pipe->fdes=E2=80=99. I=E2=80=99m not sure ab= out exporting > =E2=80=98piped-process=E2=80=99: it=E2=80=99s a bit low-level and we migh= t want to reserve > ourselves the possibility to change it, like this patch does actually. > > WDYT? > I agree. >> ... > > Please wrap lines to 80 chars. > Taken care of. > >> ... > > I suggest using =E2=80=98string=3D?=E2=80=99 above instead of =E2=80=98eq= ual?=E2=80=99. Also, could you > add a docstring? > Yes and yes. > >> ... > > Perhaps s/procs/commands/ would be clearer? Also, @var{commands} > instead of @code. > Yep. > > Could you also add an entry in doc/ref/*.texi, in the =E2=80=9CPipes=E2= =80=9D node, > perhaps with one of the examples you gave? > Wrote a new example. WDYT? > >> ... > > Please move these to the top-level =E2=80=98define-module=E2=80=99 form. > Done. > > One last thing: we=E2=80=99d need you to assign copyright to the FSF for = this. > We can discuss it off-line if you want. > Can you help me there? I already have a verbal commitment from the company, we just need to formalize it. > > Thank you for this great and long overdue addition! > Happy to add it. > > Ludo=E2=80=99. > Rutger --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Add-pipeline-procedure.patch Content-Description: PATCH >From d351c0a5ecde62e63368bec0e1f15108495a1a71 Mon Sep 17 00:00:00 2001 From: Rutger van Beusekom Date: Mon, 2 Mar 2020 10:38:57 +0100 Subject: [PATCH] Add pipeline procedure. * libguile/posix.c (scm_open_process): Remove. (scm_piped_process): Add to replace open_process. * module/ice-9/popen.scm (pipe->fdes): Add to convert pipe pair to fdes pair. (open-process): Add open-process for backwards compatibility. (pipeline): Add to implement a pipeline using piped-process. --- doc/ref/posix.texi | 27 +++++++++++++++ libguile/posix.c | 66 ++++++++++--------------------------- module/ice-9/popen.scm | 46 +++++++++++++++++++++++++- test-suite/tests/popen.test | 37 ++++++++++++++++++++- 4 files changed, 126 insertions(+), 50 deletions(-) diff --git a/doc/ref/posix.texi b/doc/ref/posix.texi index 2c85f803a..d10f6531e 100644 --- a/doc/ref/posix.texi +++ b/doc/ref/posix.texi @@ -2370,6 +2370,33 @@ processes, and a system-wide limit on the number of pipes, so pipes should be closed explicitly when no longer needed, rather than letting the garbage collector pick them up at some later time. +@findex pipeline +@deffn (Scheme Procedure) pipeline commands +Execute a @code{pipeline} of @var{commands} -- where each command is a +list of a program and its arguments as strings -- returning an input +port to the end of the pipeline, an output port to the beginning of the +pipeline and a list of PIDs of the processes executing the @var{commands}. + +@example +(let ((commands '(("git" "ls-files") + ("tar" "-cf-" "-T-") + ("sha1sum" "-"))) + (pipe-fail? (compose not + zero? + status:exit-val + cdr + waitpid))) + (receive (from to pids) (pipeline commands) + (let* ((sha1 (read-delimited " " from)) + (index (list-index pipe-fail? (reverse pids)))) + (close to) + (close from) + (if (not index) sha1 + (string-append "pipeline failed in command: " + (string-join (list-ref commands index))))))) +@result{} "52f99d234503fca8c84ef94b1005a3a28d8b3bc1" +@end example +@end deffn @node Networking @subsection Networking diff --git a/libguile/posix.c b/libguile/posix.c index a1520abc4..dac4197e9 100644 --- a/libguile/posix.c +++ b/libguile/posix.c @@ -1368,10 +1368,9 @@ start_child (const char *exec_file, char **exec_argv, #ifdef HAVE_START_CHILD static SCM -scm_open_process (SCM mode, SCM prog, SCM args) -#define FUNC_NAME "open-process" +scm_piped_process (SCM prog, SCM args, SCM from, SCM to) +#define FUNC_NAME "piped-process" { - long mode_bits; int reading, writing; int c2p[2]; /* Child to parent. */ int p2c[2]; /* Parent to child. */ @@ -1379,44 +1378,27 @@ scm_open_process (SCM mode, SCM prog, SCM args) int pid; char *exec_file; char **exec_argv; - SCM read_port = SCM_BOOL_F, write_port = SCM_BOOL_F; exec_file = scm_to_locale_string (prog); exec_argv = scm_i_allocate_string_pointers (scm_cons (prog, args)); - mode_bits = scm_i_mode_bits (mode); - reading = mode_bits & SCM_RDNG; - writing = mode_bits & SCM_WRTNG; + reading = scm_is_pair (from); + writing = scm_is_pair (to); if (reading) { - if (pipe (c2p)) - { - int errno_save = errno; - free (exec_file); - errno = errno_save; - SCM_SYSERROR; - } + c2p[0] = scm_to_int (scm_car (from)); + c2p[1] = scm_to_int (scm_cdr (from)); out = c2p[1]; } - + if (writing) { - if (pipe (p2c)) - { - int errno_save = errno; - free (exec_file); - if (reading) - { - close (c2p[0]); - close (c2p[1]); - } - errno = errno_save; - SCM_SYSERROR; - } + p2c[0] = scm_to_int (scm_car (to)); + p2c[1] = scm_to_int (scm_cdr (to)); in = p2c[0]; } - + { SCM port; @@ -1449,23 +1431,12 @@ scm_open_process (SCM mode, SCM prog, SCM args) SCM_SYSERROR; } - /* There is no sense in catching errors on close(). */ if (reading) - { - close (c2p[1]); - read_port = scm_i_fdes_to_port (c2p[0], scm_mode_bits ("r0"), - sym_read_pipe, - SCM_FPORT_OPTION_NOT_SEEKABLE); - } + close (c2p[1]); if (writing) - { - close (p2c[0]); - write_port = scm_i_fdes_to_port (p2c[1], scm_mode_bits ("w0"), - sym_write_pipe, - SCM_FPORT_OPTION_NOT_SEEKABLE); - } + close (p2c[0]); - return scm_values_3 (read_port, write_port, scm_from_int (pid)); + return scm_from_int (pid); } #undef FUNC_NAME @@ -1510,8 +1481,8 @@ SCM_DEFINE (scm_system_star, "system*", 0, 0, 1, "Example: (system* \"echo\" \"foo\" \"bar\")") #define FUNC_NAME s_scm_system_star { - SCM prog, res; - int pid, status, wait_result; + SCM prog, pid; + int status, wait_result; if (scm_is_null (args)) SCM_WRONG_NUM_ARGS (); @@ -1529,9 +1500,8 @@ SCM_DEFINE (scm_system_star, "system*", 0, 0, 1, SCM_UNDEFINED); #endif - res = scm_open_process (scm_nullstr, prog, args); - pid = scm_to_int (scm_c_value_ref (res, 2)); - SCM_SYSCALL (wait_result = waitpid (pid, &status, 0)); + pid = scm_piped_process (prog, args, SCM_UNDEFINED, SCM_UNDEFINED); + SCM_SYSCALL (wait_result = waitpid (scm_to_int (pid), &status, 0)); if (wait_result == -1) SCM_SYSERROR; @@ -2371,7 +2341,7 @@ SCM_DEFINE (scm_gethostname, "gethostname", 0, 0, 0, static void scm_init_popen (void) { - scm_c_define_gsubr ("open-process", 2, 0, 1, scm_open_process); + scm_c_define_gsubr ("piped-process", 2, 2, 0, scm_piped_process); } #endif /* HAVE_START_CHILD */ diff --git a/module/ice-9/popen.scm b/module/ice-9/popen.scm index 2afe45701..5ab93f275 100644 --- a/module/ice-9/popen.scm +++ b/module/ice-9/popen.scm @@ -22,9 +22,10 @@ #:use-module (rnrs bytevectors) #:use-module (ice-9 binary-ports) #:use-module (ice-9 threads) + #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) #:export (port/pid-table open-pipe* open-pipe close-pipe open-input-pipe - open-output-pipe open-input-output-pipe)) + open-output-pipe open-input-output-pipe pipeline)) (eval-when (expand load eval) (load-extension (string-append "libguile-" (effective-version)) @@ -84,6 +85,28 @@ (define port/pid-table (make-weak-key-hash-table)) (define port/pid-table-mutex (make-mutex)) +(define (pipe->fdes) + (let ((p (pipe))) + (cons (port->fdes (car p)) + (port->fdes (cdr p))))) + +(define (open-process mode command . args) + "Backwards compatible implementation of the former procedure in +libguile/posix.c (scm_open_process) replaced by +scm_piped_process. Executes the program @var{command} with optional +arguments @var{args} (all strings) in a subprocess. A port to the +process (based on pipes) is created and returned. @var{mode} specifies +whether an input, an output or an input-output port to the process is +created: it should be the value of @code{OPEN_READ}, @code{OPEN_WRITE} +or @code{OPEN_BOTH}." + (let* ((from (and (or (string=? mode OPEN_READ) + (string=? mode OPEN_BOTH)) (pipe->fdes))) + (to (and (or (string=? mode OPEN_WRITE) + (string=? mode OPEN_BOTH)) (pipe->fdes))) + (pid (piped-process command args from to))) + (values (and from (fdes->inport (car from))) + (and to (fdes->outport (cdr to))) pid))) + (define (open-pipe* mode command . args) "Executes the program @var{command} with optional arguments @var{args} (all strings) in a subprocess. @@ -176,3 +199,24 @@ information on how to interpret this value." "Equivalent to @code{open-pipe} with mode @code{OPEN_BOTH}" (open-pipe command OPEN_BOTH)) +(define (pipeline commands) + "Execute a pipeline of @var(commands) -- where each command is a list of a +program and its arguments as strings -- returning an input port to the +end of the pipeline, an output port to the beginning of the pipeline and +a list of PIDs of the processes executing the @var(commands)." + (let* ((to (pipe->fdes)) + (pipes (map (lambda _ (pipe->fdes)) commands)) + (pipeline (fold (lambda (from proc prev) + (let* ((to (car prev)) + (pids (cdr prev)) + (pid (piped-process (car proc) + (cdr proc) + from + to))) + (cons from (cons pid pids)))) + `(,to) + pipes + commands)) + (from (car pipeline)) + (pids (cdr pipeline))) + (values (fdes->inport (car from)) (fdes->outport (cdr to)) pids))) diff --git a/test-suite/tests/popen.test b/test-suite/tests/popen.test index 2c0877484..c780de9a7 100644 --- a/test-suite/tests/popen.test +++ b/test-suite/tests/popen.test @@ -17,7 +17,10 @@ ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA (define-module (test-suite test-ice-9-popen) - #:use-module (test-suite lib)) + #:use-module (test-suite lib) + #:use-module (ice-9 receive) + #:use-module (ice-9 rdelim)) + ;; read from PORT until eof is reached, return what's read as a string (define (read-string-to-eof port) @@ -211,3 +214,35 @@ exec 2>~a; read REPLY" (let ((st (close-pipe (open-output-pipe "exit 1")))) (and (status:exit-val st) (= 1 (status:exit-val st))))))) + + +;; +;; pipeline related tests +;; + +(pass-if "open-process" + (receive (from to pid) + ((@@ (ice-9 popen) open-process) OPEN_BOTH "rev") + (display "dlrow olleh" to) (close to) + (and (equal? "hello world" (read-string from)) + (= 0 (status:exit-val (cdr (waitpid pid))))))) + +(pass-if "piped-process" + (= 42 (status:exit-val + (cdr (waitpid ((@@ (ice-9 popen) piped-process) + "./meta/guile" '("-c" "(exit 42)"))))))) + +(pass-if "piped-process: with output" + (let* ((p (pipe)) + (pid ((@@ (ice-9 popen) piped-process) "echo" '("foo" "bar") + (cons (port->fdes (car p)) + (port->fdes (cdr p)))))) + + (and (equal? "foo bar\n" (read-string (car p))) + (= 0 (status:exit-val (cdr (waitpid pid))))))) + +(pass-if "pipeline" + (receive (from to pids) + (pipeline '(("echo" "dlrow olleh") ("rev"))) + (and (string=? "hello world\n" (read-string from)) + (equal? '(0 0) (map (compose status:exit-val cdr waitpid) pids))))) -- 2.25.1 --=-=-=--