From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id SFvkJ/GspWIfBAEAbAwnHQ (envelope-from ) for ; Sun, 12 Jun 2022 11:08:01 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id WP/kJ/GspWKAfgEA9RJhRA (envelope-from ) for ; Sun, 12 Jun 2022 11:08:01 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 41828B983 for ; Sun, 12 Jun 2022 11:08:01 +0200 (CEST) Received: from localhost ([::1]:46264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o0JZe-0003NX-Oz for larch@yhetil.org; Sun, 12 Jun 2022 05:08:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0JZQ-0003MR-Nl for gwl-devel@gnu.org; Sun, 12 Jun 2022 05:07:45 -0400 Received: from sender4-of-o50.zoho.com ([136.143.188.50]:21050) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0JZO-00074X-VQ for gwl-devel@gnu.org; Sun, 12 Jun 2022 05:07:44 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1655024859; cv=none; d=zohomail.com; s=zohoarc; b=HvuucUmVWUT0IHmQfUIuqHpptWAgmixvdumepk2MCGgWYa7qpTpnVWPwCOK/p9DpUyAgNt1Of1diLrU6rhaYWj3DH282zxabQ+EeFSDOjfb8UzX/spf6ALhp3bZX/PxpWHaUvjq/HEeDTGSKtlvGJI2NcuYiOmUwFTKd8Zp18+s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655024859; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=DEgORDULz7ncBRzAp1omUTyi5KUzZKInRPwZ2cmuQ3g=; b=k8gGMGPyAImBnu4jbogARiRz0xL2Z41I7h2ewdikYSn45j5X3aIw6EKfrdlcu0r6iIcwm8B4f9tqYmTLxB0yTAnc3mYocpVUkWEOEFvA3HLgMrzhCHNIdVXlVBra7h8toWvHQwoG8ookq9zy4MdXNeIh+Mlo3FLQKMYDKU5xaLU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1655024859; s=zoho; d=elephly.net; i=rekado@elephly.net; h=References:From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:In-reply-to:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=DEgORDULz7ncBRzAp1omUTyi5KUzZKInRPwZ2cmuQ3g=; b=LZiAoZf0H0skphdtQzBf81MEhrCdUaqlfu+zpQhdnuVi9cQL33INNplTxoP0nB0O OW14Isd0eL3PT/oMnBhJ74TUpop5GhlMV94v715ctn1I5yg7GKSzONgQC3cMNKra/Tz SqJe6ZrH5L8lYjJVwh1r/8aKaKqMXkHTSOBWTrfU= Received: from localhost (120-110-142-46.pool.kielnet.net [46.142.110.120]) by mx.zohomail.com with SMTPS id 1655024858271691.1310247250428; Sun, 12 Jun 2022 02:07:38 -0700 (PDT) References: <20220603183203.11092-1-olivier.dion@polymtl.ca> <20220606194900.27725-1-olivier.dion@polymtl.ca> <20220606194900.27725-3-olivier.dion@polymtl.ca> User-agent: mu4e 1.6.10; emacs 28.1 From: Ricardo Wurmus To: Olivier Dion Cc: gwl-devel@gnu.org Subject: Re: [PATCH 3/3] graph: Add output switch Date: Sun, 12 Jun 2022 11:05:14 +0200 In-reply-to: <20220606194900.27725-3-olivier.dion@polymtl.ca> X-URL: https://elephly.net X-PGP-Key: https://elephly.net/rekado.pubkey X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC Message-ID: <87r13u1c88.fsf@elephly.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Received-SPF: pass client-ip=136.143.188.50; envelope-from=rekado@elephly.net; helo=sender4-of-o50.zoho.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: gwl-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gwl-devel-bounces+larch=yhetil.org@gnu.org Sender: "gwl-devel" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1655024881; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=DEgORDULz7ncBRzAp1omUTyi5KUzZKInRPwZ2cmuQ3g=; b=k/sD8fpQ0EQkfgRiQL5GFT+BzJva/VBMc6frdUP8AGOFqqPCMFbcTSiOq4Cf/9VZgzGSg5 aEfT4So/OW4pqsfVgn7Wx+NtYN+L2qSk8B6wTGMH3GXKFk+8QnDFg0b7r6EYqcTQXKkGxa HR/aDnDY3q/VuXTwH2SwGvwP0pHhP5C/BEO/6qnRjdXCTFwXxcnYsyE53wnjbbs7MtIENQ ls7ckaTu3nGp0a2nWtdgl+6MRmWJ9yuvFWCH8HHNvzKgxCMJQk7RO37Qf/NwZAC7OD4pfP UzopM1K7BqLB2iFGQz+c1SbEwud0DzIjoFx8VvFVeDwbOEhEIun75qqZndsIog== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1655024881; a=rsa-sha256; cv=pass; b=iJW0WQ+HFIgiZ/ShJih8LkodEqDNSQcAOv/9OCiTk8jojMZw8Ctjlo+1K5hlc2q+N+Pj3I XJNlBtCfow9tphWoVISged6wlqFMO6Zzf9A2UaLGq8iZJ1JRTKnbjrRdPcSzNeX5Si7JWx wFkIahwUZXEspWuYmj2/iL7gTPg6W+j0JaM8R/B6HjqWXuCWxqrT++s6PCLtBUPu/9kN5Q ONW1H9XWnmfc2q9HPVEMV2k9qKJJIKPyrTvkwkbt/+3MlqUN5OkHn9xoYbKm36XhuTkJKz 2M4TJavaJPY8ArWuaF1LHtNlxN1pSuzpC8D7ORbUpdYHgp062dmVbtoQdSXm6A== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=elephly.net header.s=zoho header.b=LZiAoZf0; arc=pass ("zohomail.com:s=zohoarc:i=1"); dmarc=none; spf=pass (aspmx1.migadu.com: domain of "gwl-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="gwl-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -9.49 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=elephly.net header.s=zoho header.b=LZiAoZf0; arc=pass ("zohomail.com:s=zohoarc:i=1"); dmarc=none; spf=pass (aspmx1.migadu.com: domain of "gwl-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="gwl-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 41828B983 X-Spam-Score: -9.49 X-Migadu-Scanner: scn0.migadu.com X-TUID: 58aSy/KNSfJy Hi Olivier, > diff --git a/gwl/main.scm b/gwl/main.scm > index 78494fd..7f0fd14 100644 > --- a/gwl/main.scm > +++ b/gwl/main.scm > @@ -17,6 +17,7 @@ > (define-module (gwl main) > #:use-module (config) > #:use-module (config api) > + #:use-module ((guix build utils) #:select (mkdir-p)) > #:use-module (gwl errors) > #:use-module (gwl process-engines) > #:use-module (gwl web-interface) > @@ -95,5 +96,15 @@ > (parameterize ((*current-filename* file-name)) > (match (load-workflow file-name) > ((? workflow? wf) > - (format #t "~a\n" (workflow->dot wf))) > + > + (define (flush) > + (format #t "~a\n" (workflow->dot wf))) > + > + (define output (%config 'output)) > + > + (if output > + (begin > + (mkdir-p (dirname output)) > + (with-output-to-file output flush)) > + (flush))) > (_ (leave (G_ "Failed to process the workflow.~%"))))))))= ))) The name =E2=80=9Cflush=E2=80=9D really confused me, because it already has= a meaning with regard to buffering. I=E2=80=99d prefer to rewrite this (format #t "~a\n" (workflow->dot wf)) to (format port "~a\n" (workflow->dot wf)) and then arrange for port to either be (current-output-port) or some file port. --=20 Ricardo