Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@INFO("osreturncode") isn't working #89

Open
taviso opened this issue Jun 11, 2022 · 2 comments
Open

@INFO("osreturncode") isn't working #89

taviso opened this issue Jun 11, 2022 · 2 comments

Comments

@taviso
Copy link
Owner

taviso commented Jun 11, 2022

I think if you do this, the result should be 123:

123 -e '{system "exit 123"}@INFO("osreturncode")~'

It isn't, it's 31488 ... which is 123 << 8, so maybe it's the wrong endianness or something?

@taviso
Copy link
Owner Author

taviso commented Jun 12, 2022

Ah, the bug is that UNIX system() returns the result, but Linux system() returns the wait status, and 1-2-3 doesn't know that.

Hmm, on the one hand It's easy to fix (just add WEXITSTATUS()), but should we fix it? Maybe it's more useful having all the wait() flags available?

Note: as a workaround you can do @INFO("osreturncode") / 2^8

@OnesuchDev
Copy link

Actually, SCO OpenServer returns the wait status too: http://osr507doc.sco.com/cgi-bin/man?mansearchword=/usr/man2/html.S/system.S.html&mansection=
And Solaris: https://man.freebsd.org/cgi/man.cgi?query=system&apropos=0&sektion=0&manpath=SunOS+5.10&arch=default&format=html
So this likely behaved the same even on a supported OS.

FWIW, Windows returns the exit code; I haven't developed anything for DOS but perhaps DOS C libraries do as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants