[PD] Control external command from Pd

Jack jack at rybn.org
Thu Dec 1 11:37:18 CET 2016


Le 01/12/2016 à 11:30, Roman Haefeli a écrit :
> On Thu, 2016-12-01 at 11:09 +0100, Jack wrote:
>> Hello Roman,
>>
>> Did you try :
>>
>> [command & echo $!(
>>>
>>>
>> [shell]
>>
>> It will return the pid of 'command'.
> 
> Yes, you're right: It's not even necessary to put that into an extra
> script (I thought I had to because of the dollar sign).
> 
> However, the problem remains: When I send 'command' to background,
> [shell] won't output its stdout to the left outlet anymore.

Hmm, weird, did you get something with ? :
(start Pd from a directory where there are files and directories).

[ls & echo $!(
|
[shell]
|
[print]

++

Jack


> 
> Roman
> 
> 
>> Le 01/12/2016 à 10:52, Roman Haefeli a écrit :
>>>
>>> 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.
>>>
>>> On the other, I can launch a wrapper script that sends command to
>>> the
>>> background and returns its PID:
>>>
>>> #!/bin/sh
>>> command & 
>>> echo $!
>>>
>>> and in Pd, I do:
>>>
>>> [./wrapper.sh (
>>>>
>>>>
>>> [shell]
>>>
>>> and the left outlet of [shell] gives me the PID of the command
>>> which
>>> allows me to reliably kill that instance later. However, this way
>>> [shell] doesn't output the command's stdout. 
>>>
>>> Is there a way to have my cake and eat it, too?
>>>
>>> Roman
>>>
>>>
>>>
>>> _______________________________________________
>>> Pd-list at lists.iem.at mailing list
>>> UNSUBSCRIBE and account-management -> https://lists.puredata.info/l
>>> istinfo/pd-list
>>>
>>
>> _______________________________________________
>> Pd-list at lists.iem.at mailing list
>> UNSUBSCRIBE and account-management -> https://lists.puredata.info/lis
>> tinfo/pd-list
>>
>>
>> _______________________________________________
>> Pd-list at lists.iem.at mailing list
>> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20161201/efba37e4/attachment.sig>


More information about the Pd-list mailing list