Skip to content

Commit 8b8bf39

Browse files
gibfahnMylesBorins
authored andcommittedJul 11, 2017
build: avoid passing kill empty input in Makefile
Using `xargs -r` on some platforms and `xargs` on others doesn't work, we can't guarantee whether xargs is GNU or not. Avoid the issue by only running kill if there are processes to clean. PR-URL: #12158 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent abc2c82 commit 8b8bf39

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed
 

‎Makefile

+12-11
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,13 @@ test/addons/.buildstamp: config.gypi \
186186
# TODO(bnoordhuis) Force rebuild after gyp update.
187187
build-addons: $(NODE_EXE) test/addons/.buildstamp
188188

189-
ifeq ($(OSTYPE),$(filter $(OSTYPE),darwin aix))
190-
XARGS = xargs
191-
else
192-
XARGS = xargs -r
193-
endif
194189
clear-stalled:
190+
# Clean up any leftover processes but don't error if found.
195191
ps awwx | grep Release/node | grep -v grep | cat
196-
ps awwx | grep Release/node | grep -v grep | awk '{print $$1}' | $(XARGS) kill
192+
@PS_OUT=`ps awwx | grep Release/node | grep -v grep | awk '{print $$1}'`; \
193+
if [ "$${PS_OUT}" ]; then \
194+
echo $${PS_OUT} | xargs kill; \
195+
fi
197196

198197
test-gc: all test/gc/node_modules/weak/build/Release/weakref.node
199198
$(PYTHON) tools/test.py --mode=release gc
@@ -221,8 +220,9 @@ test-ci-js: | clear-stalled
221220
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
222221
--mode=release --flaky-tests=$(FLAKY_TESTS) \
223222
$(TEST_CI_ARGS) $(CI_JS_SUITES)
224-
# Clean up any leftover processes
225-
PS_OUT=`ps awwx | grep Release/node | grep -v grep | awk '{print $$1}'`; \
223+
# Clean up any leftover processes, error if found.
224+
ps awwx | grep Release/node | grep -v grep | cat
225+
@PS_OUT=`ps awwx | grep Release/node | grep -v grep | awk '{print $$1}'`; \
226226
if [ "$${PS_OUT}" ]; then \
227227
echo $${PS_OUT} | $(XARGS) kill; exit 1; \
228228
fi
@@ -233,10 +233,11 @@ test-ci: | clear-stalled build-addons
233233
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
234234
--mode=release --flaky-tests=$(FLAKY_TESTS) \
235235
$(TEST_CI_ARGS) $(CI_NATIVE_SUITES) $(CI_JS_SUITES)
236-
# Clean up any leftover processes
237-
PS_OUT=`ps awwx | grep Release/node | grep -v grep | awk '{print $$1}'`; \
236+
# Clean up any leftover processes, error if found.
237+
ps awwx | grep Release/node | grep -v grep | cat
238+
@PS_OUT=`ps awwx | grep Release/node | grep -v grep | awk '{print $$1}'`; \
238239
if [ "$${PS_OUT}" ]; then \
239-
echo $${PS_OUT} | $(XARGS) kill; exit 1; \
240+
echo $${PS_OUT} | xargs kill; exit 1; \
240241
fi
241242

242243
test-release: test-build

0 commit comments

Comments
 (0)
Please sign in to comment.