You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "casaroli (via GitHub)" <gi...@apache.org> on 2026/10/18 15:04:29 UTC

[PR] nshlib: Let exit take an exit status. [nuttx-apps]

casaroli opened a new pull request, #3873:
URL: https://github.com/apache/nuttx-apps/pull/3873

   ## Summary
   
   The NSH `exit` command took no argument and always exited with 0. `exit 3` failed with "too many arguments", so a script or `sh -c` could not report a failure with `exit`.
   
   This PR lets `exit` take an optional exit status from 0 to 255, as POSIX does. A status that is not a number, or is out of range, gives an error. Without an argument, `exit` still uses 0.
   
   ## Impact
   
   `exit <status>` works. `exit` without an argument does not change. apache/nuttx#NNNN documents the argument.
   
   ## Testing
   
   `qemu-armv8a:knsh` (QEMU 11 with HVF on an Apple M4): a test program runs `sh -c` with these commands:
   
   | `sh -c` command | master | this PR |
   |---|---|---|
   | `exit 3` | 255 | 3 |
   | `exit 0` | 255 | 0 |
   | `exit` | 0 | 0 |
   | `exit abc` | 255 | 255 (error) |
   | `exit 256` | 255 | 255 (error) |
   
   `ostest` on `qemu-armv8a:knsh` and `qemu-armv8a:nsh` ends with `ostest_main: Exiting with status 0`. `tools/checkpatch.sh -c -u -m -g` passes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] nshlib: Let exit take an exit status. [nuttx-apps]

Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis merged PR #3873:
URL: https://github.com/apache/nuttx-apps/pull/3873


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org