[Gambas-user] Timely reading of shell command output in process read event.

RICHARD WALKER richard.j.walker at ...247...
Sun Jul 15 01:36:56 CEST 2012


I am having difficulty reading the output from a shell command when it
is generated. Something somewhere seems to be storing the messages
until it is ready to give them to my READ and ERROR event handlers.

The command is invoked with:

JCap = Shell Command For Read As "Jack_Capture"

My Jack_Capture_Read() procedure has used both

Read #Last, item, 0 - Lof(Last)

and

Line Input #Last, item

The Jack_Capture_Error(item As String) procedure has no choice - it
gets what it is given.

The console output from the shell command has been checked and all of
the print_message(String) commands in the C source are '\n'
terminated.

The shell command produces progress reports as it executes, one per
line, and in particular there will often be a delay of several seconds
- even minutes - between it issuing the statement "Waiting for
JackTransportRolling.\n" and "Received JackTranportRolling.
Recording.\n". In practice, the message that the transport is rolling
is delayed until the transport is stopped and the READ event gets it
at the same time as the ERROR event reports another message.

It is a little confusing perhaps, but the shell command produces
output on both stdout and stderr and I have to catch both to know the
full story about how the recording is progressing.

When the same command and parameters are executed in a real terminal
then all of the messages appear in sequence at the expected times.

Can anyone suggest where these messages might be buffered and how to
hurry them along?

Thanks

Richard




More information about the User mailing list