[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Process.Wait not behaving as expected


On 1/2/26 8:35 AM, Benoît Minisini wrote:
Le 02/01/2026 à 01:03, Benoît Minisini a écrit :
Le 01/01/2026 à 18:23, Lee a écrit :
On 1/1/26 12:22 PM, Lee wrote:
I am shelling out to a command for which I need to catch any error message and the exit code.

I can't use Process.Wait without a timeout as it is a server and my project application would hang forever. However, when I use .Wait with any value other than 0, the exit code is not correctly set in Process.Value.

Am I misunderstanding how Process.Wait should work, or is this unintended behavior?

Demo project attached.



Oops, almost forgot. This is with Gambas 3.21.1.


Yes, there is a design error in how the timeout is handled, and the result is that the value returned by the process is not catched.

I will fix that.


It should be fixed with commit https://gitlab.com/gambas/gambas/-/commit/316340a1bf762373a485209798ac3560c2ac28c3.

Regards,


Okay, I compiled and installed the latest master (316340a).

It does seem to work. But, I had to set the timeout to a full 1 second before the shell script output and exit code were caught properly. (I presume this was necessary to give the shell command time to print its output and exit.)

Giving Process.Wait a value of 0 seems to work better than any non-zero value. Is this similar to how "WAIT 0" works?


--
Lee

--- Gambas User List Netiquette [https://gambaswiki.org/wiki/doc/netiquette] ----
--- Gambas User List Archive [https://lists.gambas-basic.org/archive/user] ----


Follow-Ups:
Re: Process.Wait not behaving as expectedBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
References:
Process.Wait not behaving as expectedLee <t.lee.davidson@xxxxxxxxx>
Re: Process.Wait not behaving as expectedLee <t.lee.davidson@xxxxxxxxx>
Re: Process.Wait not behaving as expectedBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: Process.Wait not behaving as expectedBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>