#1 Yesterday 07:49:29

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 465

runcommand returns -1 even in successful start

Hi,
With the last updates the following returns -1 where in the past the result was 0.

res:=RunCommand(apppath+'test.exe',false);

The test.exe is started ok even with the -1 result

Offline

#2 Yesterday 15:34:19

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,182
Website

Re: runcommand returns -1 even in successful start

You call RunCommand() with waitfor = false, so we call CreateProcessW() and we don't wait for completion.
So the returned value is no true ExitCode but just a CreateProcessW() success flag.
We should return 0 on success for sure. Thanks for the report! smile

I have restored the previous behavior.
Please try
https://github.com/synopse/mORMot2/commit/de2fdbbec

Offline

#3 Yesterday 20:01:40

tfopc
Member
Registered: 2024-01-08
Posts: 34

Re: runcommand returns -1 even in successful start

Hi ab and dcoun,

just a hint - the winapi has a error code for this, but i understand that it is maybe a "breaking change" for existing apps that rely on the status=0 for successful process-creation.

STILL_ACTIVE = STATUS_PENDING;

https://learn.microsoft.com/en-us/windo … odeprocess

But maybe i'am wrong with the usage for this purpose.

Last edited by tfopc (Yesterday 20:04:22)

Offline

Board footer

Powered by FluxBB