With a script like
process.on("SIGINT", () => {
console.log("SIGINT received");
});
process.on("SIGTERM", () => {
console.log("SIGTERM received");
});
setInterval(() => {
console.log("tick");
}, 1000);
running node index.js and sending it a SIGINT it will continue running.
When using Yarn switch running yarn node index.js the switch process terminates and the underlying process keeps running.
Dockerfile reproduction:
FROM node:24.13.0
RUN curl -s https://repo.yarnpkg.com/install | bash
ENV PATH="/root/.yarn/switch/bin:$PATH"
RUN yarn switch --version
RUN cat <<EOF > index.js
process.on("SIGINT", () => {
console.log("SIGINT received");
});
process.on("SIGTERM", () => {
console.log("SIGTERM received");
});
setInterval(() => {
console.log("tick");
}, 1000);
EOF
CMD ["yarn", "node", "index.js"]
Building and running that container it terminates as soon as the signal arrives instead of continuing to run.
With a script like
running
node index.jsand sending it a SIGINT it will continue running.When using Yarn switch running
yarn node index.jsthe switch process terminates and the underlying process keeps running.Dockerfile reproduction:
Building and running that container it terminates as soon as the signal arrives instead of continuing to run.