freeprocess

BlitzMax Forums/BlitzMax Programming/freeprocess

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?

Try to check if something is available to read before reading the line.

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


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)

very interesting I just tried IF proc.err.readAvail() and it never returns true but there is text there to read?

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...

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.

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...

this is interesting. what exactly do you use this for?