[Gambas-user] about process

Benoit Minisini gambas at ...1...
Sat Nov 29 11:03:30 CET 2003


On Saturday 29 November 2003 02:10, Edward Hsu wrote:
> Dear Benoit,
>
> I wrote a front end for mplayer and it shows the
> current time of playing and total time for current
> song. It works fine on Gambas 0.70b, but doesn't work
> after that version because after 0.70b we cannot have
>
> EXEC["mplayer","-slave",$sPath] FOR READ WRITE AS
> $hProcess
>
> As we know that READ option should not be used.
> Without that option we cannot use Process_Read to read
> the current time and total time. I enclose my simple
> program for you to debug. The program is working fine
> for music only, the current time is not right for
> video yet. And You can click on the progress bar to
> move to any position of your song.
>
> Thanks,
>
> Edward
>

Hi, Edward

Maybe you didn't understand the new EXEC behaviour well :-)

You can do:

EXEC["mplayer","-slave",$sPath] FOR READ WRITE AS $hProcess

But then, you MUST read the process output in the Process_Read() event handler 
(that was Process_Write in Gambas 0.70b), otherwise the executed process will 
block.

And you can must use stream functions on the process object to read and write 
data: PRINT, LINE INPUT, etc.

In Gambas 0.70b, then process output was always read by the interpreter, and 
then dropped if there was no event handler. So you could use FOR READ without 
any problem. Now, you can't !

Rewrite your example, and I will test it, because I'm only working on the last 
Gambas version.

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...





More information about the User mailing list