freeprocess

BlitzMax Forums/BlitzMax Programming/freeprocess

Nigel Brown(Posted 2007) [#1]
I have tracked a crash down to freeprocess I am calling
text = proc.err.readline$()

from a timer set @ 25Hz. When the crash occurs. This is a total bomb of the program, no errors application just dissapears.

When I slow the timer to 10Hz the crash stops, I will try and produce some example code to go with this soon. but would seem to me that something is overflowing?


klepto2(Posted 2007) [#2]
Try to check if something is available to read before reading the line.

IF proc.err.readAvail() = true then
   text = proc.err.readline()
endif



H&K(Posted 2007) [#3]
Running things from timers is bit like using multiTasking (Ok notice ppl I said a BIT like), and you have to be sure that one prossess isnt deleting things that another prossess needs. So as Klepto said just look-see it still exists.
The reason 10 probably works and 25 doesnt is simply down to luck. (Ok simplistic, but hah)


Nigel Brown(Posted 2007) [#4]
very interesting I just tried IF proc.err.readAvail() and it never returns true but there is text there to read?


Chris C(Posted 2007) [#5]
you have to check that you close all file handles, you can quickly run out of file handles, I made a post about it somewhere but cant seem to find it now...


klepto2(Posted 2007) [#6]
Try this:
process:TProcess = CreateProcess("tracert blitzforum.de")

handle:TPipeStream = process.pipe


DebugLog handle.ReadAvail()
DebugLog handle.ReadLine()
While process
   If handle.ReadAvail()
    Local Line:String = handle.ReadLine()
    If Line <> "" Then Print Line
   EndIf
Wend 


If you're using MaxGui and you are trying to read the output, then you have to call PollSystem() within the 'while process' loop.


Chris C(Posted 2007) [#7]
http://www.blitzmax.com/Community/posts.php?topic=67091 see my third post and after if you are creating multiple tprocess objects rather than just using one...


ninjarat(Posted 2007) [#8]
this is interesting. what exactly do you use this for?