Page 1 of 1

Pfind, Pmusic, etc still running?

Posted: Tue 21 Apr 2009, 06:26
by DaveS
I keep reading about these applications needing to be shut down 'properly' to prevent them from running in the background. From Pmusic experience, I guess this means that just closing the window is not enough, and the 'quit' or whatever command must be used to kill the process? If one just closes the window, does this mean that when activating the program again, a second instance is initiated, or does the original which is running in the background, reappear?

Posted: Tue 21 Apr 2009, 12:26
by BarryK
Well, zigbert can answer this better than me. I know there are issues with processes left running and that annoys me when I want to unmount a partition. I don't know if it affects anything when you want to rerun the application.

It may be that those apps need to have the user interface redesigned to remove this problem. I think it is because of the pulldown menus.

Or, it may be possible to create a workaround to fix it. There can be a wrapper for the actual application. When the app is killed, execution returns to the wrapper which then makes sure all processes are killed before exiting. Well, that is more than possible, its doable.

Posted: Tue 21 Apr 2009, 15:59
by zigbert
BarryK wrote:Or, it may be possible to create a workaround to fix it. There can be a wrapper for the actual application. When the app is killed, execution returns to the wrapper which then makes sure all processes are killed before exiting. Well, that is more than possible, its doable.
I'll look into this in the weekend. Just too busy these days.


Sigmund

Posted: Wed 22 Apr 2009, 09:50
by zigbert
I have made a simple workaround that kills pid after closing gtkdialog-script (including drop-down menu). This example is Pburn. I have edited the startup-script in /usr/bin/. Since I'm not really a programmer, I would like someone with more knowledge to look through the codelines. There could be many other ways to do this, that are much better. - I don't know, just happy it works.

I will include this (or another) workaround in the next release of
Pburn
Pmusic
Pfind
Pbackup
Pwidgets
Hopefully other Pscripts with same issue could use this.
Pdvdrsab
Pcdripper
Pmetatagger
Psip
Pctorrent
Wallpaper

Code: Select all

#!/bin/bash
"/usr/local/pburn/pburn" "$@" &

#Start loop to kill PID when window closes.
#This is a workaround for a bug in gtkdialog.
sleep 10
while [ A != B ]; do
	TMP="`xwininfo -stats -name Pburn`"
	if [ ! "$TMP" ]; then
		for I in `ps | grep Pburn | grep gtkdialog | awk '{print $1}'`; do kill -9 $I 2> /dev/null; done
		for I in `ps | grep -i pburn | awk '{print $1}'`; do kill -9 $I 2> /dev/null; done
		exit 0
	fi
	sleep 3
done

Sigmund

Posted: Wed 22 Apr 2009, 09:56
by trio
Ziggy,

This is how I do it (in the wallpaper express - preview function)

TMP=`ps | grep 'Pburn' | awk '{print $1}'`

kill $TMP

Taken from your pprocess' script :lol: , I don't know if it can be applied in this case or not

Posted: Wed 22 Apr 2009, 10:28
by aragon
Don't know if this is related/helps but you maybe want to have a look at

Code: Select all

/usr/local/bin/prename
line 343 ff

Code: Select all

...
RESULTS="`$GTKDIALOG --program=MAIN_DIALOG --center`"

###exit the program if the X button is pushed
if [ "`echo $RESULTS | grep abort`" != "" ]; then
exit 0
fi

##incase quit was selected, let's exit the program
if [ "`echo $RESULTS | grep EXIT_NOW`" != "" ]; then
exit 0
fi
...
aragon

Posted: Wed 22 Apr 2009, 11:51
by zigbert
aragon
Prename does not have the same issue, because it has no menus. the Prename script gets the control back after child process is done. - That's why I have started a loop instead of waiting for child-process to return to parent.

trio
The main issue is not the killing, but to scan X to see if pburn-window is actually up. Your (mine :D ) code is simpler, but I had some trouble in the past killing ALL child processes. That was with Pfind, - and I still have the same problems, so your code might fit better in the end. I guess my 2 'for-loops' takes much more time than your grep.


Thanks for input !!!!!
Sigmund

Posted: Wed 22 Apr 2009, 13:15
by aragon
ok, starting to understand the problem a litlle bit... ;-)

aragon

Posted: Thu 23 Apr 2009, 00:42
by ecomoney
Hi, I just want to mention that the P series apps have brought a lot of useability to puppy linux, from what I have seen of the end users I have using 4 series puppy. Zig, you definetely qualify as a "programmer" in my book.

I hope someone with a bit more in-depth knowledge helps you sort these problems out, and lets you get back to designing great front ends!

Posted: Thu 23 Apr 2009, 10:17
by trio
Hi,

just wanna share a workaround, will kill all gtkdialog at start up, or supposed to :lol: just try

Posted: Tue 28 Apr 2009, 07:14
by ecomoney
This problem has been fixed by Zigbert in 0.8 which he just released. It needs testing though (like anything with a zero on the end).

Get it from here.

http://www.murga-linux.com/puppy/viewtopic.php?t=31206