From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 AM5YOCK/mGIQ/gAAbAwnHQ (envelope-from ) for ; Thu, 02 Jun 2022 15:46:10 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id YGA+OCK/mGI4WgEAauVa8A (envelope-from ) for ; Thu, 02 Jun 2022 15:46:10 +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 87E663702B for ; Thu, 2 Jun 2022 15:46:10 +0200 (CEST) Received: from localhost ([::1]:36850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwl9N-0003Op-ME for larch@yhetil.org; Thu, 02 Jun 2022 09:46:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43532) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwl9F-0003NM-U7 for guix-patches@gnu.org; Thu, 02 Jun 2022 09:46:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59299) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwl9F-0004jk-KH for guix-patches@gnu.org; Thu, 02 Jun 2022 09:46:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nwl9F-0001be-Ib for guix-patches@gnu.org; Thu, 02 Jun 2022 09:46:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55420] [PATCH 0/2] Add a function to parse emacs elisp's package header Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 02 Jun 2022 13:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55420 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Fredrik Salomonsson Cc: 55420@debbugs.gnu.org Received: via spool by 55420-submit@debbugs.gnu.org id=B55420.16541775076101 (code B ref 55420); Thu, 02 Jun 2022 13:46:01 +0000 Received: (at 55420) by debbugs.gnu.org; 2 Jun 2022 13:45:07 +0000 Received: from localhost ([127.0.0.1]:53196 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nwl8M-0001aL-S1 for submit@debbugs.gnu.org; Thu, 02 Jun 2022 09:45:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49980) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nwl8H-0001ZH-8W for 55420@debbugs.gnu.org; Thu, 02 Jun 2022 09:45:04 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:58462) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwl8B-0004Iq-U0; Thu, 02 Jun 2022 09:44:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=hgz1J84dNs239QybEBgkJeh8jkAiu+o0aqUwSf7RBKo=; b=GdG+Tjuwkrkpeh22S55P X7d7bRSyAYogQ83GfbQthup/v1YFH/rmqEAHIEqL8LmVsaO3wHl4Kall8mBVE0l9fGHgeH2jCTQlN ICdxfkh4iKjGjehQx8Kt3EGtiv0Tr8xSWEgl4lobc4Q2ZNtqvaRQj9xLx1OC0LTHhkjDqygVT4ajD Sq0HpH0heGejjnBRaOts8p50PtXNgtgonyISh663en6RCesKCn8XCI41u85BWQIqNhPSO/VtA/l2+ reDm+3+tNqAZpVJM5PDV6hgcaf1LzG91aN/d4KB3ATx2olPqyQbwJEzsAFlE0PdtN2vWnp90RIq7t v4SWMiR0g33ezg==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:57632 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwl8B-0002hx-8G; Thu, 02 Jun 2022 09:44:55 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20220514230017.27372-1-plattfot@posteo.net> <20220514230508.27885-1-plattfot@posteo.net> <87ee08t8z5.fsf_-_@gnu.org> <87zgivai89.fsf@d2.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Quartidi 14 Prairial an 230 de la =?UTF-8?Q?R=C3=A9volution, ?= jour de l'Acacia X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Thu, 02 Jun 2022 15:44:53 +0200 In-Reply-To: <87zgivai89.fsf@d2.com> (Fredrik Salomonsson's message of "Thu, 02 Jun 2022 02:53:42 +0000") Message-ID: <87fsknp4bu.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1654177570; 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:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=hgz1J84dNs239QybEBgkJeh8jkAiu+o0aqUwSf7RBKo=; b=YpTXTZQRGT/73C9O3DCxHqrqX+ei024lcyVE5w1g8XYZTQwlWYDZRrm5JnF+3YqL/Vqta9 3JL6gYMFuSHWGyd21oZdnb2HoJJXIrumWl2W1PxQJlkZojty588JhKc5vygjQr8UuKZxux mFS4Z88ZlnYj8Am0PKMk8Tfw5Sc3rNfFqao8Ygj0C7FIKJgQNm8q0Odg1T6x8fG2czJAlw VEmiA/XDisI/VucT65NKijBLe62Y7auJn0dkPN4jv9nX15plv8dBq61IOTfarDgvwrAhyW hY7krPWvAPpnSDJE5QMGfy4wqQEUIOV7yV5TYgnJPSU/zbM3FLfjT/QMdjaPDQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1654177570; a=rsa-sha256; cv=none; b=TbrpXJfboL3UvtX/E96ZRmR+yJKYfavtryWwlSGZx6Ij6imtxlBNhCTMqwgqkUGDehFVij CikvhfKnCL3KBBHxYzByjJuvIdL4Vz5DvcXU0T5mk27SWzZfTNCN8TS6hPeJ+x5ZB2hozK rY+JMKVhwLHSTxvPEsdLQFVi92KXZylKhBx6gPN241Tv2ZcP+hP9oQEozB3cD5SMTV97F8 d4avhX+K6cyGNvpxHoxt39oHtLoafEX8pag+CMremtK0F8O1mH7auce2hBJzCTlkyovo8m bBvrb5dsecv4wJuMJRZgl74fKp6RXb9wP6zmH6JMmCehgKVR+K/OshlG+JPSuA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=GdG+Tjuw; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.92 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=GdG+Tjuw; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 87E663702B X-Spam-Score: -3.92 X-Migadu-Scanner: scn1.migadu.com X-TUID: vfcqBvENiFGg Hi, Fredrik Salomonsson skribis: > Here is what I have so far: > > (define-condition-type &emacs-batch-error &error > emacs-batch-error? > (expression emacs-batch-error-expression) > (message emacs-batch-error-message)) >=20=20=20=20=20 > (define (emacs-batch-script expr) > "Execute the Elisp code EXPR in Emacs batch mode and return output." > (let* ((error-pipe (open-output-string)) > (pipe (with-error-to-port error-pipe > (lambda () > (open-pipe* > OPEN_READ > (%emacs) "--quick" "--batch" > (string-append "--eval=3D" (expr->string expr))))= )) > (output (read-string pipe)) > (error (get-output-string error-pipe)) > (status (close-pipe pipe))) > (unless (zero? status) > (raise (condition (&emacs-batch-error > (expression expr) > (message error))))) > output)) Unfortunately =E2=80=98open-pipe*=E2=80=99 is not smart enough to redirect = stderr to a non-file port (a string port in this case). One way around it would be to merge stdout and stderr, like so: (parameterize ((current-error-port (current-output-port))) (open-pipe* =E2=80=A6)) but then you get both on the same stream, which could be a problem for instance if Emacs emits warnings and such. You could work around it by establishing a second pipe: (match (pipe) ((stderr-input . stderr-output) (parameterize ((current-error-port stderr-output)) (open-pipe* =E2=80=A6)))) Here you should be able to read, in the parent process, from =E2=80=98stderr-input=E2=80=99. Another option is to not try to capture stderr: after all, that=E2=80=99ll = get printed on the screen anyway. HTH, Ludo=E2=80=99.