Skip to content

Commit 159a916

Browse files
committed
release: Don't let node mess up stdio
Node leaves stdio file descriptors in non-blocking mode when exiting. This has been reported, fixed, unfixed, ad nauseum. nodejs/node#14752 nodejs/node#17737 nodejs/node#20592 nodejs/node#21257 Stolen from cockpit-project/cockpit@ef50d97cf4
1 parent 5732e22 commit 159a916

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

release/Dockerfile

+5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ yum-utils \
4242

4343
ADD * /usr/local/bin/
4444

45+
# HACK: Working around Node.js screwing around with stdio
46+
ENV NODE_PATH /usr/bin/node.real
47+
RUN mv /usr/bin/node /usr/bin/node.real
48+
ADD node-stdio-wrapper /usr/bin/node
49+
4550
VOLUME /home/user /build
4651
WORKDIR /build
4752
USER user

release/node-stdio-wrapper

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
# This is certified, A-grade, high quality turd polish. Node leaves
4+
# stdio file descriptors in non-blocking mode when exiting. This has
5+
# been reported, fixed, unfixed, ad nauseum.
6+
#
7+
# https://github.com/nodejs/node/issues/14752
8+
# https://github.com/nodejs/node/pull/17737
9+
# https://github.com/nodejs/node/pull/20592
10+
# https://github.com/nodejs/node/pull/21257
11+
#
12+
# It's starting to fester.
13+
14+
OUT=$(/usr/bin/node.real "$@" 2>&1 </dev/null)
15+
ret=$?
16+
echo -n "$OUT"
17+
exit $ret

0 commit comments

Comments
 (0)