Skip to content

Commit

Permalink
build: fix Makefile wrt finding node executable
Browse files Browse the repository at this point in the history
Not all shells set PWD, so use CURDIR instead.

`which node` may return the empty string, so guard against
that too. Consider:
if [ -x `which velociraptor` ] && [ -e `which velociprator` ];\
then echo "run"; else echo "keep calm"; fi;

PR-URL: nodejs#18040
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
  • Loading branch information
hashseed committed Jan 11, 2018
1 parent 315d1f5 commit a2c7085
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Expand Up @@ -14,6 +14,7 @@ COVTESTS ?= test-cov
GTEST_FILTER ?= "*"
GNUMAKEFLAGS += --no-print-directory
GCOV ?= gcov
PWD = $(CURDIR)

ifdef JOBS
PARALLEL_ARGS = -j $(JOBS)
Expand Down Expand Up @@ -640,7 +641,7 @@ out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets
available-node = \
if [ -x $(PWD)/$(NODE) ] && [ -e $(PWD)/$(NODE) ]; then \
$(PWD)/$(NODE) $(1); \
elif [ -x `which node` ] && [ -e `which node` ]; then \
elif [ -x `which node` ] && [ -e `which node` ] && [ `which node` ]; then \
`which node` $(1); \
else \
echo "No available node, cannot run \"node $(1)\""; \
Expand Down

0 comments on commit a2c7085

Please sign in to comment.