Unable to use "read from process" timeout

Hi all,

I seem to be unable to use timeouts for the read from process command.

For demonstration purposes, I have the following program:

Hello.bat:

@echo Hello
@pause > nul

Now, I call it from Eggplant as follows:

Test.script:

open process "cmd.exe" with options {parameters: ["/c", "Hello.bat"]}

// Works fine
read from process "cmd.exe" until return
put the time && it

// !!! Blocks indefinitely instead of 5 seconds !!!
read from process "cmd.exe" timeout after 5 seconds
put the time && it

The first read works fine and outputs as expected:

03:25 PM Hello[returnKey]

However, the second read blocks indefinitely instead of terminating after 5 seconds.

The same behavior can also be observed when using the global readTimeout property instead of the timeout after clause.

Can someone help me get timeouts to work, please?

Even better: is there a way to poll for unread process data without blocking at all?

Any help would be appreciated!

The fact that it hangs forever says that you’ve run into a bug, so please report it. I would be curious to know if the behavior is the same when you also specify the amount to read. What happens if you do this:
read from process "cmd.exe" until return timeout after 5 seconds

As a way of working around the problem, you might try having your process (Hello.bat in your example) write its output to a file, and have your script read from the file instead of directly from the process.