At a process or thread limit (for example a container's cgroup pids.max),
starting the thread that waits for a new PTY's exit throws std::system_error.
node-pty is built to catch only Napi::Error, so that error escaped to
std::terminate and the daemon aborted, taking every terminal with it and
logging nothing.
The node-pty patch now catches the failed watcher start (or a failed
allocation), releases its thread-safe function, kills and reaps the child,
closes the master fd and throws a JS error ("node-pty: exit_watcher_thread
failed: ... (errno N)"). A failed forkpty also reports its errno. Process
limits map to the process-limit hint; running out of pseudo-terminals keeps
the pseudo-terminal hint.
A Linux test caps a child's RLIMIT_NPROC so the watcher thread is refused and
checks that the spawn fails with the hint while the process lives. It runs in
its own serial step of the "shell contracts" CI job.
Fixes#40326