mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
src: tolerate EPERM returned from tcsetattr
macOS app sandbox makes tcsetattr return EPERM. The CHECK_EQ(0, err)
here would fail when a sandboxed Node.js process is exiting. This commit
fixes this issue.
* test: add test for running in macOS app sandbox
Bare-bone command-line executables cannot run directly in the app sandbox.
To test that Node.js is able to run in the sandbox (and to test the fix in
317621b4a1), this commit creates a typical
Cocoa app bundle, puts the node executable in it and calles Apple's codesign
command to enable sandbox.
* test: use process.execPath to get path of testing node
PR-URL: https://github.com/nodejs/node/pull/33944
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
56124e92e8
commit
cb2c8106a7
4 files changed
+101
-1
No files matched your search
+4
-1
@@ -730,7 +730,10 @@ void ResetStdio() {
|
||||
err = tcsetattr(fd, TCSANOW, &s.termios);
|
||||
while (err == -1 && errno == EINTR); // NOLINT
|
||||
CHECK_EQ(0, pthread_sigmask(SIG_UNBLOCK, &sa, nullptr));
|
||||
CHECK_EQ(0, err);
|
||||
|
||||
// Normally we expect err == 0. But if macOS App Sandbox is enabled,
|
||||
// tcsetattr will fail with err == -1 and errno == EPERM.
|
||||
CHECK_IMPLIES(err != 0, err == -1 && errno == EPERM);
|
||||
}
|
||||
}
|
||||
#endif // __POSIX__
|
||||
|
||||
Reference in new issue
Block a user