free process bug

Archives Forums/BlitzMax Bug Reports/free process bug

Chris C(Posted 2007) [#1]
				cmd="find "+GadgetText(filetxt)+" -type f -exec grep '"+tx+"' {} /dev/null \;"
				Print "cmd="+cmd
				proc=TProcess.create(cmd,0)


an example of cmd that works in a terminal would be...
find /home/chris/dev/browse -type f -exec grep 'browse' {} /dev/null \;


I dont see any output on the pipe like i would for a simple "command blah" command string


Chris C(Posted 2007) [#2]
part of the command works if i give the full path for find
(not mentioned in the docs for freeprocess!)

I think the problem is when find tries to execute grep.
As a work round I'm just going to split it in two and execute grep from a list built by find...

freeprocess has a number of important advantages over some kind of nasty thread hack, so it might be an idea to thoroughly document what you can and cant do with the module...


Chris C(Posted 2007) [#3]
found and issue with file handles

if i use a large number of TProcess objects I can end up running out of file handles (glib error)

I have to do this, to get it to work once I have finished with a TProcess


					If proc Then 
						proc.close()
						proc.terminate()
					EndIf
					proc=Null
					GCCollect



skidracer(Posted 2007) [#4]
The new process should inherit the applications current dir.

I have a current problem of running bash as a process. I'm not sure linux/osx processes are inheriting the environment variables, or I have to connect some tty type pipe to the process.


Chris C(Posted 2007) [#5]
I can live without the environment vars for the time being, you really do need to close the pipes properly if the GC collects a Tprocess tho!


check out extern char **environ; .....


Nigel Brown(Posted 2007) [#6]
I am using =null, GCCollect as suggested after finishing with a process. The amount of memory in the task manager still rises for the application?