From: Timothy Sample <samplet@ngyro.com>
To: Jacob Hrbek <kreyren@rixotstudio.cz>
Cc: guile-user@gnu.org
Subject: Re: How to capture pid of (system process?
Date: Fri, 17 Dec 2021 11:24:04 -0500 [thread overview]
Message-ID: <877dc36vyz.fsf@ngyro.com> (raw)
In-Reply-To: <45d70782-ec32-355d-9ecd-44e0dc8de4e8@rixotstudio.cz> (Jacob Hrbek's message of "Fri, 17 Dec 2021 01:32:56 +0000")
Hi Jacob,
Jacob Hrbek <kreyren@rixotstudio.cz> 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’s the Guile reference for the procedures
you’d need:
https://www.gnu.org/software/guile/manual/html_node/Processes.html
Alternatively, if you are feeling adventurous – you must be if you are
using Potato Make :) – you could try and use Gash, too. You would end
up with a very Scheme-y Make experience indeed!
Gash’s interface is laser focused on shell semantics so far, so it’s a
little wonky as a Scheme library, but here’s 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 ‘sh:async’, so you would have to build
it from Git. It might not be super practical, but it would be fun! :)
-- Tim
prev parent reply other threads:[~2021-12-17 16:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-13 21:01 How to capture pid of (system process? Jacob Hrbek
2021-12-14 13:05 ` Tim Van den Langenbergh
2021-12-14 13:25 ` Maxime Devos
2021-12-17 1:32 ` Jacob Hrbek
2021-12-17 6:45 ` Maxime Devos
2021-12-17 16:24 ` Timothy Sample [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877dc36vyz.fsf@ngyro.com \
--to=samplet@ngyro.com \
--cc=guile-user@gnu.org \
--cc=kreyren@rixotstudio.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).