unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Jacob Hrbek <kreyren@rixotstudio.cz>
To: guile-user@gnu.org
Subject: How to capture pid of (system process?
Date: Mon, 13 Dec 2021 21:01:16 +0000	[thread overview]
Message-ID: <25238084-6589-146f-566c-89f7df9afad9@rixotstudio.cz> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 820 bytes --]

I wrote this potato-make <https://github.com/spk121/potato-make> 
definition (was simplified):

#:SRC_BEGIN sheme-mode
#!/usr/bin/env sh
exec guile -s "$0" "$@"
!#

(use-modules (ice-9 futures)
  (potato make))
(initialize)

(: "watch" '()
    (~ (do ((i 1 (1+ i)))
       ((> i 6))
     (future (system
      "emacs"))
     ;;(let ((emacs_pid (getpid)))
      ;; (kill emacs_pid SIGTERM)))))

(execute)
#:SRC_END

expecting to capture emacs's pid and kill it, but the issue is that 
using `getpid` gets me the PID of potato-make and `getppid` of the shell 
-> How can i capture just the emacs's pid?

FWIW the projected end-goal is 3600 loop that checks if the 
`my-theme.el` file has been changed to re-launch emacs with the theme 
loaded used for theme development.


[-- Attachment #1.2: publickey - kreyren@rixotstudio.cz - 1677db82.asc --]
[-- Type: application/pgp-keys, Size: 713 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 249 bytes --]

             reply	other threads:[~2021-12-13 21:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-13 21:01 Jacob Hrbek [this message]
2021-12-14 13:05 ` How to capture pid of (system process? 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

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=25238084-6589-146f-566c-89f7df9afad9@rixotstudio.cz \
    --to=kreyren@rixotstudio.cz \
    --cc=guile-user@gnu.org \
    /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).