Closed
Description
- Version:
v6.11.5
- Platform:
Linux blade9 4.12.12-gentoo #2 SMP Tue Nov 21 19:16:19 CET 2017 x86_64 Intel(R) Xeon(R) CPU E5450 @ 3.00GHz GenuineIntel GNU/Linux
- Subsystem: async stdio?
Problem is related to the following issue: nodejs/node-v0.x-archive#3027
Steps to reproduce with uglifyjs
(2.4.10) - an error occurs randomly:
Gets some JS files:
mkdir node-test; cd node-test;
wget -q 'https://code.jquery.com/jquery-migrate-3.0.1.js'
wget -q 'https://code.jquery.com/jquery-3.3.1.min.js'
wre@blade9 ~/node-test $ ls -l
total 112
-rw-r--r-- 1 wre wre 86927 Jan 20 18:26 jquery-3.3.1.min.js
-rw-r--r-- 1 wre wre 17813 Sep 27 2017 jquery-migrate-3.0.1.js
Call uglifyjs
and try to capture the output:
wre@blade9 ~/node-test $ (cat jquery-migrate-3.0.1.js | uglifyjs 2>/dev/null; cat jquery-3.3.1.min.js)|(cat - >/dev/null)
cat: write error: Resource temporarily unavailable
wre@blade9 ~/node-test $ (cat jquery-migrate-3.0.1.js | uglifyjs 2>/dev/null; cat jquery-3.3.1.min.js)|(cat - >/dev/null)
wre@blade9 ~/node-test $ (cat jquery-migrate-3.0.1.js | uglifyjs 2>/dev/null; cat jquery-3.3.1.min.js)|(cat - >/dev/null)
wre@blade9 ~/node-test $ (cat jquery-migrate-3.0.1.js | uglifyjs 2>/dev/null; cat jquery-3.3.1.min.js)|(cat - >/dev/null)
cat: write error: Resource temporarily unavailable
wre@blade9 ~/node-test $ (cat jquery-migrate-3.0.1.js | uglifyjs 2>/dev/null; cat jquery-3.3.1.min.js)|(cat - >/dev/null)
wre@blade9 ~/node-test $ (cat jquery-migrate-3.0.1.js | uglifyjs 2>/dev/null; cat jquery-3.3.1.min.js)|(cat - >/dev/null)
cat: write error: Resource temporarily unavailable
Workaround using mktemp
:
(cat jquery-migrate-3.0.1.js | (TMP="$(mktemp)"; uglifyjs 1>"$TMP" 2>/dev/null; cat "$TMP"; rm "$TMP"); cat jquery-3.3.1.min.js)|(cat - >/dev/null)
Do you know a better way to make those pipes work?