[Gambas-user] Capricious Shell instruction

Benoît Minisini gambas at ...1...
Sun Jan 6 02:19:02 CET 2013


Le 06/01/2013 01:40, Tobias Boege a écrit :
> Hi Benoit,
>
> we came across some strange symptoms with the Shell instruction. Namely, the
> amount of output is quite different depending on
>
> a) whether a Process is created or the Shell ... To syntax is used;
> b) how much commands are specified and how long each one executes;
> c) where the output is sent to.
>
> I prepared a test suite. The single case Hans originally pointed out can be
> reproduced here: it is case "aca" in the demonstration project. It gives
> only a small percentage of the total output of the "env" command. The
> other ones I added are reliably reproducible on my system: Gambas rev#5492.
> Though, the numbers of lines vary from time to time where not the full
> output is shown.
>
> There is one control window and the big text window on its right is one of
> the two "output targets". The smaller text window below the main one is to
> display descriptions of the test case and the symptoms observed over here.
>
> I hope it is reproducible on other machines and that the project is readable
> enough for you. Sorry if these errors are due to wrong assumptions I made
> concerning the Shell instruction.
>
> Regards,
> Tobi
>

Apparently this is a bug introduced in Line Input since it has been 
optimized, that prevents the process output to be flushed when the 
process has been killed

Replace 'Line Input' by 'Read', and Shell should work as expected in all 
cases.

By the way, you should never use Line Input to read a process stream, as 
Line Input blocks if it does not receive the end-of-line character.

Regards,

-- 
Benoît Minisini




More information about the User mailing list