Skip to content

Commit

Permalink
Remove dependency on 'which' for nix
Browse files Browse the repository at this point in the history
* add set -eu to detect failures in the bash script
  • Loading branch information
Peaker committed Sep 28, 2019
1 parent 44d5b7b commit 1cbc715
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions build_node.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

set -eu
mkdir -p bin

# adapted from https://apple.stackexchange.com/a/123408/11374
Expand All @@ -9,8 +10,9 @@ NODE_VERSION=`node --version`
VER=$(version "$NODE_VERSION")

if [[ $(version "v6.2.1") -le $VER ]]; then
echo "Using existing system node $NODE_VERSION"
cp "$(which node)" bin/node.exe
FROM="$(type -p node)"
echo "Using existing system node $NODE_VERSION from $FROM"
cp "$FROM" bin/node.exe
else
echo "Building nodejs from source"
# node not available or too old. Build from source.
Expand Down

0 comments on commit 1cbc715

Please sign in to comment.