[PD] Control external command from Pd

Roman Haefeli reduzent at gmail.com
Thu Dec 1 12:02:39 CET 2016


On Thu, 2016-12-01 at 11:29 +0100, Peter P. wrote:
> * Roman Haefeli <reduzent at gmail.com> [2016-12-01 10:52]:
> > 
> > Hey all
> > 
> > I would like to use Pd to start and stop several instances of a
> > certain
> > command. I need to catch the stdout of the commands in Pd, so I can
> > monitor their status. Also, I want to be able to kill them
> > individually.
> > 
> > I tried to achieve that with [ggee/shell], but there are some
> > culprits. 
> > 
> > When I launch the command directly in [shell] like this:
> > 
> > [command (
> > > 
> > > 
> > [shell]
> > 
> > I get the command's stdout on the left outlet of [shell], but I
> > don't
> > know of a reliable way to send a SIGHUP signal to command.
> You could try to start the command and then execute 
> 	pidof command name
> which should return the PID(s) of running commands, which you could
> kill/hangup with yet another command.

I tried that and it works to some degree, but it is very unreliable if
have many instances of command running. I haven't found a _reliable_
way to assign many PIDs to individual commands.

Also, I figured out that 'pidof' is not available per default on OS X
and I'd like my patch work on both, Linux and OS X.

If there'd be a way to send a SIGHUP (Ctrl-C) to the currently running
command, it would make things a lot easier, but [shell] tries to start
another process instead of directing the ASCII DEC 3 to command.
 

> Not totally on-topic, but after a discussion with a friend yesterday
> I
> am curious if the functionality of ggee/shell can't be achieved with
> pd-send and pd-receive as well?

Yes, maybe, though I don't see how this would facilitate things. You
would have to write a script that parses the output of pdreceive and
performs some actions accordingly. But this would be insane to do in
bash, I'd rather do it in python, then.

Roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20161201/cea97ef0/attachment.sig>


More information about the Pd-list mailing list