On Sat, Apr 25, 2020 at 8:24 PM Darrin M. Gorski <dar...@gorski.net> wrote:
>
> Wondering why FreeDOS COMMAND.COM doesn't exit with ERRORLEVEL like other 
> command processors.  main() in command.c ends with "return 0" where it should 
> really be "return errorlevel".

Like what other command processors?

> This way error codes are returned to the calling shell (or other program).

In the old DOS days, COMMAND.COM *was* the calling shell things
returned to, so not setting ERRORLEVEL was no surprise.  The
assumption was that it was the boot shell.  What might fail and
generate a meaningful ERRORLEVEL was the program you were running
*from* COMMAND.COM.

> For my purposes it is a requirement that the errorlevel is returned to the 
> calling shell/program.
> Any options?

What are your purposes?

What will the calling shell/program be to receive and take action
based on the ERRORLEVEL returned?  And under what circumstances might
COMMAND.COM exit with a non-zero ERRORLEVEL if it did set one?

I believe the alternative 4DOS shell can set an ERRORLEVEL, intended
to be useful when it is invoked as a sub-shell.

> - Darrin
______
Dennis


_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to