-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
node_main: use ERROR_EXE_MACHINE_TYPE_MISMATCH instead 1 as exit code #8204
Conversation
System Error Codes in Windows is here. |
@@ -7,7 +7,7 @@ int wmain(int argc, wchar_t *wargv[]) { | |||
if (!IsWindows7OrGreater()) { | |||
fprintf(stderr, "This application is only supported on Windows 7, " | |||
"Windows Server 2008 R2, or higher."); | |||
exit(1); | |||
exit(0xd8); // code: ERROR_EXE_MACHINE_TYPE_MISMATCH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can also #include <windows.h>
above and then use the macro directly, if you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@addaleax thank for your suggestion, windows.h
has not been used yet in other sources, such that including windows.h here would increase the building time because:
It defines a very large number of Windows specific functions that can be used in C.
I'm not sure if we should include that file for a simple macro?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yorkie ¯_(ツ)_/¯ … I doubt that it would make a huge difference.
Two nits, the commit message should probably use |
cb7152b
to
b0b52de
Compare
@addaleax Fix nits, BTW the CI seems failed :( |
Well, new CI run then just to be sure: https://ci.nodejs.org/job/node-test-commit/4709/ |
@nodejs/platform-windows ... I'm not too familiar with how these codes are typically used on Windows. Is this a fairly innocuous change or is there the possibility of breaking things? (that is, is this a semver-patch or semver-major?) |
I think this should be marked as |
By the way, the CI failed on arm-fanned with https://ci.nodejs.org/job/node-test-binary-arm/3476/RUN_SUBSET=1,label=pi1-raspbian-wheezy/console, I'm not sure if this is related with this patch, cc @nodejs/build :( |
@yorkie Can you include just The commit message is still too long. What about something like I confirm the CI failure is unrelated. |
1f4e6f5
to
f2f1ccc
Compare
@joaocgreis Done, thanks for your tip and confirmation :) |
LGTM pending CI: https://ci.nodejs.org/job/node-test-pull-request/3829/ Thanks! |
Ping @nodejs/ctc because this has been marked as major :) |
Still LGTM :) |
Could someone please confirm if the CI#3829 is green or that not related with this change? |
That CI was green with only known flaky failures on AIX. |
If `IsWindows7OrGreater()` returns `false`, the Node.js program should exit with a more specific code ERROR_EXE_MACHINE_TYPE_MISMATCH instead the code 0x1(ERROR_INVALID_FUNCTION) PR-URL: nodejs#8204 Reviewed-By: João Reis <reis@janeasystems.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
f2f1ccc
to
a080f1a
Compare
Ok @addaleax, could we land this now as a080f1a? |
@yorkie I see no reason not to :) (If anything I said came over as meaning that this would be blocked by me, that was definitely not my intent 😄) |
If `IsWindows7OrGreater()` returns `false`, the Node.js program should exit with a more specific code ERROR_EXE_MACHINE_TYPE_MISMATCH instead the code 0x1(ERROR_INVALID_FUNCTION) PR-URL: #8204 Reviewed-By: João Reis <reis@janeasystems.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Landed in a3c5567 and never mind, just confirmation if this commit is completely right :) |
Checklist
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
windows
Description of change
If
IsWindows7OrGreater()
returnsfalse
, the Node.js program shouldexit with a more specific code ERROR_EXE_MACHINE_TYPE_MISMATCH instead
the code 0x1(ERROR_INVALID_FUNCTION).