From 969c89bf553f30ea47359391eeb829aa3ac6c27d Mon Sep 17 00:00:00 2001 From: Yang Guo Date: Mon, 8 Jan 2018 16:31:07 +0100 Subject: [PATCH] build: fix Makefile wrt finding node executable 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: https://github.com/nodejs/node/pull/18040 Reviewed-By: Evan Lucas Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Joyee Cheung --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 213284aa70cd15..3763c78e916bb0 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ COVTESTS ?= test-cov GTEST_FILTER ?= "*" GNUMAKEFLAGS += --no-print-directory GCOV ?= gcov +PWD = $(CURDIR) ifdef JOBS PARALLEL_ARGS = -j $(JOBS) @@ -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)\""; \