From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Timothy Sample Newsgroups: gmane.lisp.guile.user Subject: Re: How to capture pid of (system process? Date: Fri, 17 Dec 2021 11:24:04 -0500 Message-ID: <877dc36vyz.fsf@ngyro.com> References: <25238084-6589-146f-566c-89f7df9afad9@rixotstudio.cz> <5f0a15eea9c3b9d111f8e096a3a37571a95e5795.camel@telenet.be> <45d70782-ec32-355d-9ecd-44e0dc8de4e8@rixotstudio.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24393"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cc: guile-user@gnu.org To: Jacob Hrbek Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Fri Dec 17 17:24:37 2021 Return-path: Envelope-to: guile-user@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 1myG28-00064x-BI for guile-user@m.gmane-mx.org; Fri, 17 Dec 2021 17:24:36 +0100 Original-Received: from localhost ([::1]:57104 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1myG26-0007G4-62 for guile-user@m.gmane-mx.org; Fri, 17 Dec 2021 11:24:34 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:42446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1myG1p-0007Fl-VR for guile-user@gnu.org; Fri, 17 Dec 2021 11:24:18 -0500 Original-Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:33633) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1myG1n-0008KX-KQ for guile-user@gnu.org; Fri, 17 Dec 2021 11:24:17 -0500 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id A37F73201D74; Fri, 17 Dec 2021 11:24:06 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 17 Dec 2021 11:24:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=31C07TMZvvbjOZ6HbprtzJUG+xNPfhi+SF0YqUozI YE=; b=T5QjqSzitquMeIrZHmdx64NpuG1l7EJfdvyNsgWOwyu36lH1PTTAqq+9y uRymKxdYMUUa/153YWwRb+I0FrRKDSzwt8fgWq/yW0Dr8Vf0rYkGrb26LJxeL+T7 Nt45rb0E3r3U11eB6Up75u4yRAz3+ckrUklFNZu+XK3TvLAWUEcR5yoiXv+h7kSq ek5oYa5oK7xCM8UxjLxKppID8fmuWJrFgjR705xPb9SWd8Mf/ujpYfmsjI82Z62y 5YSmjqS1KMBni6rZzrgqs3PG4NkAOZvJTQCyJ3ahtM1kg1KWmEGysGuiVAVn2hhH ERAm/DHTu4vnbVP1aHMI3bc2Achow== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrleeigdeklecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufhffjgfkfgggtgfgsehtqhertddtreejnecuhfhrohhmpefvihhmohht hhihucfurghmphhlvgcuoehsrghmphhlvghtsehnghihrhhordgtohhmqeenucggtffrrg htthgvrhhnpedvleevhfehgeduveejvdeftdevieelffevheevjeeggfetteetjeetledt feeuveenucffohhmrghinhepghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehsrghmphhlvghtsehnghihrhhordgtohhm X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 17 Dec 2021 11:24:05 -0500 (EST) In-Reply-To: <45d70782-ec32-355d-9ecd-44e0dc8de4e8@rixotstudio.cz> (Jacob Hrbek's message of "Fri, 17 Dec 2021 01:32:56 +0000") Received-SPF: pass client-ip=64.147.123.25; envelope-from=samplet@ngyro.com; helo=wout2-smtp.messagingengine.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17867 Archived-At: Hi Jacob, Jacob Hrbek writes: >> If you want to do things asynchronuously, you can look at >> open-pipe. It should also be possible to build anything you want with >> the lower-level fork, execl, dup->fdes, ... primitives (assuming >> things are single-threaded). > > Can you elaborate? (I am noob in guile atm) If you want to dig into it, the GNU manual is not half bad: https://www.gnu.org/software/libc/manual/html_node/Processes.html Guile just wraps those same C functions, so that description applies quite well to Guile. Here=E2=80=99s the Guile reference for the procedures you=E2=80=99d need: https://www.gnu.org/software/guile/manual/html_node/Processes.html Alternatively, if you are feeling adventurous =E2=80=93 you must be if you = are using Potato Make :) =E2=80=93 you could try and use Gash, too. You would = end up with a very Scheme-y Make experience indeed! Gash=E2=80=99s interface is laser focused on shell semantics so far, so it= =E2=80=99s a little wonky as a Scheme library, but here=E2=80=99s an example: (use-modules (gash environment) (gash shell)) (sh:async (lambda () (execlp "emacs"))) (display "waiting a bit...\n") (sleep 5) (let ((emacs-pid (get-last-job))) (display "sending SIGTERM to ") (display emacs-pid) (newline) (kill emacs-pid SIGTERM)) Gash is very much experimental software when used like this, though. The latest release does not have =E2=80=98sh:async=E2=80=99, so you would h= ave to build it from Git. It might not be super practical, but it would be fun! :) -- Tim