RunProgram()

Linux specific forum
Christian
Enthusiast
Enthusiast
Posts: 154
Joined: Mon Dec 08, 2003 7:50 pm
Location: Germany

RunProgram()

Post by Christian »

Hi!

This question was ask in the german forum from somebody. I tried it out and got the same problem. It's the following:

Using the RunProgram() function in Linux starts the external program but doesn't quits it. So at least until the PB program is quited. Here is an example code:

Code: Select all

S$="hallo"

If RunProgram("/bin/echo",S$,"",1) = 0
    MessageRequester("Error","Programm konnte nicht gestartet werden!",0)
    End
EndIf

Repeat
ForEver
So it opens the echo programm and then goes into a endless loop. The Flag of the RunProgram() function is set to "Wait until the launched program quits". So normally the endless loop should start after the echo program quits. But calling "ps aux" in a console shows that the echo program runs. ([echo <defunc>])

If I quit the PB programm with strg+c the echo programm also stops. But this is of course not wanted. So could this be a bug of PB or is it a "bug" in my thoughts?

best regards,
Christian
piie
New User
New User
Posts: 3
Joined: Fri Feb 20, 2004 3:00 pm
Location: /Germany/Ulm

Post by piie »

Hi Christian, after I did'nt get an answer in the pure-board.de, I thought to post my problem here might give a solution,... but then I saw you even translated and posted my problem, thank you :)

maybe we will get some help here..
Christian
Enthusiast
Enthusiast
Posts: 154
Joined: Mon Dec 08, 2003 7:50 pm
Location: Germany

Post by Christian »

Hi piie! :)

I hope so, but unfortunataly it does not seem so, yet. But we will see ... it's really a strange thing!
piie
New User
New User
Posts: 3
Joined: Fri Feb 20, 2004 3:00 pm
Location: /Germany/Ulm

Post by piie »

I hope somebody have a idea how to handle this. If not, we should talk to the developer, or? Because this is not just a little bug, I think. Under Linux you need nearly in every program the help of other linux-tools. And it is not very nice to see thousands of <defunc> Threads running....
pbdep
User
User
Posts: 68
Joined: Fri Apr 25, 2003 5:18 pm
Location: Netherlands

Post by pbdep »

Its not a problem of RunProgram or of anything !

Also a [ DEFUNC ] is nothing bad, its only a fact that
the forked process could not find the root process to kill it.

AND because you probably run the program during comilation
you see the Forked process..nothing bad !!

you see probably in your PS -->

./purebasic.exe
echo [ defunc ]


Your program runs just fine when you run it standalown
and kill it with a CTRL-C.

Pbdep.
piie
New User
New User
Posts: 3
Joined: Fri Feb 20, 2004 3:00 pm
Location: /Germany/Ulm

Post by piie »

hm.. the problem is, that i started to build a tool with wich you can change the volume (therefor i use >aumix<) or run other applications by using a joypad and after i compiled and ran it, i do a few volumechanges and my processlist shows as much defunc aumix processes as volumechanges i did..
This tool have to do much more than maybe 1000 volume changes, before it will be stopped. And it doesnt look nice if you have so much useless threads in your ps. I also think, that these 1000 processes will speed down my cpu.
Linux... or do you have the engine of a lawn mower in your sports car?!
Post Reply