Hi all,
I'm having some troubles with two pd instances and [shell].
I launch a patch with the first Pd instance from the terminal. Here, i use [shell] to create a new patch and open it with a second Pd instance.
when the new patch is loaded, it sends a [quit( message to [noquit] to the first pd-instance patch, via OSC, in order to kill it.
everything works fine until the first instance receive the OSC message. At this point, the pd process is killed but the GUI freezes on the screen, and the terminal freezes too.
If I launch the first Pd instance from the terminal with '&', and then run the script through the same terminal, it works fine.
this below is the script. nothing fancy.
any idea why the process doesn't work?
thanksss!
\\\\\\\\\\\\\\\ #!/bin/bash
NEWPATCH=$1 cp /usr/share/Xth-Sense/Xth-Sense.pd $HOME/Desktop/$NEWPATCH.pd; sleep 2; pdextended -alsa $HOME/Desktop/$NEWPATCH.pd; exit \\\\\\\\\
-- Marco Donnarumma New Media + Sonic Arts Practitioner, Performer, Teacher, Director. Embodied Audio-Visual Interaction Research Team. Department of Computing, Goldsmiths University of London
Portfolio: http://marcodonnarumma.com
Research: http://res.marcodonnarumma.com
Director: http://www.liveperformersmeeting.net
When you launch the first pd followed with "&" then run the script, you end up with two separate pd instances.
When you use [shell] to launch the second one, you end up with the second pd instance as a child of the first process. You can visualize the difference using "ps -Ha".
Unfortunately I don't know enough about interprocess communication under Linux to know why it freezes. Maybe this hack will work:
[echo "env DISPLAY=:0 pd-extended" | at now( | [shell]
Replace pd-extended with the name of your pd executable. Now the second Pd instance runs as a child of the "at" daemon, so you should be able to close the original Pd instance without a problem.
I should mention that this highlights a big security risk when running arbitrary Pd patches with a setup where [shell] is loadable by default. Using the "at" command (or probably other tricks) the pd patch can run arbitrary code that can stick around after that Pd instance has terminated.
Also, keep in mind that there's an X11 diagnostic tool called xinput that echoes the keyboard input for _every_ window in the x session, and that there's an object called [netsend], and a startup flag called -nogui.
But even without [shell], a patch can dynamically created [key] and [netsend] objects inside the unvis'd pd-_float or pd-_float_array subpatches that exist in every running instance of Pd, and that code will stick around until the Pd instance is terminated. But it will only log keystrokes that are attached to Pd patch windows.
-Jonathan
From: Marco Donnarumma devel@thesaddj.com To: pd-list@iem.at Sent: Saturday, April 13, 2013 11:39 AM Subject: [PD] troubles killing a pd instance with shell object
Hi all,
I'm having some troubles with two pd instances and [shell].
I launch a patch with the first Pd instance from the terminal. Here, i use [shell] to create a new patch and open it with a second Pd instance.
when the new patch is loaded, it sends a [quit( message to [noquit] to the first pd-instance patch, via OSC, in order to kill it.
everything works fine until the first instance receive the OSC message. At this point, the pd process is killed but the GUI freezes on the screen, and the terminal freezes too.
If I launch the first Pd instance from the terminal with '&', and then run the script through
the same terminal, it works fine.
this below is the script. nothing fancy.
any idea why the process doesn't work?
thanksss!
\\\\\\\\\\\\\\\ #!/bin/bash
NEWPATCH=$1 cp /usr/share/Xth-Sense/Xth-Sense.pd $HOME/Desktop/$NEWPATCH.pd; sleep 2; pdextended -alsa $HOME/Desktop/$NEWPATCH.pd; exit \\\\\\\\\
-- Marco Donnarumma New Media + Sonic Arts Practitioner, Performer, Teacher, Director. Embodied Audio-Visual Interaction Research Team. Department of Computing, Goldsmiths University of London
Portfolio: http://marcodonnarumma.com Research: http://res.marcodonnarumma.com Director: http://www.liveperformersmeeting.net _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
This is just a wild guess what two things coming to mind based on your description. First, you have to make sure that your shell script ends with "exit 0" command. Second, you can always try to simply kill the pd-gui process together with PD. The trick in this case will be finding out the right process ID because you don't want to kill both PD instances--this can be done again with a shell script before the second instance has been started.
HTH On Apr 13, 2013 11:40 AM, "Marco Donnarumma" devel@thesaddj.com wrote:
Hi all,
I'm having some troubles with two pd instances and [shell].
I launch a patch with the first Pd instance from the terminal. Here, i use [shell] to create a new patch and open it with a second Pd instance.
when the new patch is loaded, it sends a [quit( message to [noquit] to the first pd-instance patch, via OSC, in order to kill it.
everything works fine until the first instance receive the OSC message. At this point, the pd process is killed but the GUI freezes on the screen, and the terminal freezes too.
If I launch the first Pd instance from the terminal with '&', and then run the script through the same terminal, it works fine.
this below is the script. nothing fancy.
any idea why the process doesn't work?
thanksss!
\\\\\\\\\\\\\\\ #!/bin/bash
NEWPATCH=$1 cp /usr/share/Xth-Sense/Xth-Sense.pd $HOME/Desktop/$NEWPATCH.pd; sleep 2; pdextended -alsa $HOME/Desktop/$NEWPATCH.pd; exit \\\\\\\\\
-- Marco Donnarumma New Media + Sonic Arts Practitioner, Performer, Teacher, Director. Embodied Audio-Visual Interaction Research Team. Department of Computing, Goldsmiths University of London
Portfolio: http://marcodonnarumma.com Research: http://res.marcodonnarumma.com Director: http://www.liveperformersmeeting.net _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
hey,
I've tried Ivica suggestion, but it didn't work.
Jonathan strategy works good. What I do now, is to send a message
[echo "env DISPLAY=:0 my-script.sh" | at now(
This runs the whole script, and not only the pd patch, under the at daemon (as Jonhatan said previously), and this way I can kill the parent Pd instance. Works like a charm.
Thanks for your prompt responses!
-- Marco Donnarumma New Media + Sonic Arts Practitioner, Performer, Teacher, Director. Embodied Audio-Visual Interaction Research Team. Department of Computing, Goldsmiths University of London
Portfolio: http://marcodonnarumma.com
Research: http://res.marcodonnarumma.com
Director: http://www.liveperformersmeeting.net
On Sat, Apr 13, 2013 at 10:04 PM, Ivica Bukvic <ico@vt.edu> wrote:
> This is just a wild guess what two things coming to mind based on your
> description. First, you have to make sure that your shell script ends with
> "exit 0" command. Second, you can always try to simply kill the pd-gui
> process together with PD. The trick in this case will be finding out the
> right process ID because you don't want to kill both PD instances--this can
> be done again with a shell script before the second instance has been
> started.
>
> HTH
> On Apr 13, 2013 11:40 AM, "Marco Donnarumma" <devel@thesaddj.com> wrote:
>
>> Hi all,
>>
>> I'm having some troubles with two pd instances and [shell].
>>
>> I launch a patch with the first Pd instance from the terminal. Here, i
>> use [shell] to create a new patch and open it with a second Pd instance.
>>
>> when the new patch is loaded, it sends a [quit( message to [noquit] to
>> the first pd-instance patch, via OSC, in order to kill it.
>>
>> everything works fine until the first instance receive the OSC message.
>> At this point, the pd process is killed but the GUI freezes on the screen,
>> and the terminal freezes too.
>>
>> If I launch the first Pd instance from the terminal with '&', and then
>> run the script through
>> the same terminal, it works fine.
>>
>> this below is the script. nothing fancy.
>>
>> any idea why the process doesn't work?
>>
>> thanksss!
>>
>>
>> \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
>> #!/bin/bash
>>
>> NEWPATCH=$1
>> cp /usr/share/Xth-Sense/Xth-Sense.pd $HOME/Desktop/$NEWPATCH.pd;
>> sleep 2;
>> pdextended -alsa $HOME/Desktop/$NEWPATCH.pd;
>> exit
>> \\\\\\\\\\\\\\\\\\
>>
>>
>>
>>
>> --
>> Marco Donnarumma
>> New Media + Sonic Arts Practitioner, Performer, Teacher, Director.
>> Embodied Audio-Visual Interaction Research Team.
>> Department of Computing, Goldsmiths University of London
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> Portfolio: http://marcodonnarumma.com
>> Research: http://res.marcodonnarumma.com
>> Director: http://www.liveperformersmeeting.net
>>
>> _______________________________________________
>> Pd-list@iem.at mailing list
>> UNSUBSCRIBE and account-management ->
>> http://lists.puredata.info/listinfo/pd-list
>>
>>