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

test: shared lib build doesn't handle SIGPIPE #19211

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@
'sources': [
'src/node_main.cc'
],
'includes': [
'node.gypi'
],
'include_dirs': [
'src',
'deps/v8/include',
Expand All @@ -220,9 +223,6 @@
}],
[ 'node_intermediate_lib_type=="static_library" and '
'node_shared=="false"', {
'includes': [
'node.gypi'
],
'xcode_settings': {
'OTHER_LDFLAGS': [
'-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)'
Expand Down Expand Up @@ -469,22 +469,8 @@
],
}],
],
'defines!': [
'NODE_PLATFORM="win"',
],
'defines': [
'FD_SETSIZE=1024',
# we need to use node's preferred "win32" rather than gyp's preferred "win"
'NODE_PLATFORM="win32"',
# Stop <windows.h> from defining macros that conflict with
# std::min() and std::max(). We don't use <windows.h> (much)
# but we still inherit it from uv.h.
'NOMINMAX',
'_UNICODE=1',
],
'libraries': [ '-lpsapi.lib' ]
}, { # POSIX
'defines': [ '__POSIX__' ],
'sources': [ 'src/backtrace_posix.cc' ],
}],
[ 'node_use_etw=="true"', {
Expand Down
18 changes: 18 additions & 0 deletions node.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@
'NODE_SHARED_MODE',
],
}],
[ 'OS=="win"', {
'defines!': [
'NODE_PLATFORM="win"',
],
'defines': [
'FD_SETSIZE=1024',
# we need to use node's preferred "win32" rather than gyp's preferred "win"
'NODE_PLATFORM="win32"',
# Stop <windows.h> from defining macros that conflict with
# std::min() and std::max(). We don't use <windows.h> (much)
# but we still inherit it from uv.h.
'NOMINMAX',
'_UNICODE=1',
],
}, { # POSIX
'defines': [ '__POSIX__' ],
}],

[ 'node_enable_d8=="true"', {
'dependencies': [ 'deps/v8/src/d8.gyp:d8' ],
}],
Expand Down
18 changes: 18 additions & 0 deletions src/node_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,30 @@ int wmain(int argc, wchar_t *wargv[]) {
#endif // __LP64__
extern char** environ;
#endif // __linux__
#if defined(__POSIX__) && defined(NODE_SHARED_MODE)
#include <string.h>
#include <signal.h>
#endif

namespace node {
extern bool linux_at_secure;
} // namespace node

int main(int argc, char *argv[]) {
#if defined(__POSIX__) && defined(NODE_SHARED_MODE)
// In node::PlatformInit(), we squash all signal handlers for non-shared lib
// build. In order to run test cases against shared lib build, we also need
// to do the same thing for shared lib build here, but only for SIGPIPE for
// now. If node::PlatformInit() is moved to here, then this section could be
// removed.
{
struct sigaction act;
memset(&act, 0, sizeof(act));
act.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &act, nullptr);
}
#endif

#if defined(__linux__)
char** envp = environ;
while (*envp++ != nullptr) {}
Expand Down