Skip to content

Commit f6f381b

Browse files
committed
make node-kill and node binary detection more robust
1 parent e9a2c03 commit f6f381b

12 files changed

+60
-55
lines changed

get_alinode_version

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
export ENABLE_NODE_LOG=NO
44

5-
NODE=`which node`
5+
DIR=$(cd "$(dirname "$0")"; pwd)
6+
GET_NODE_EXE=$DIR/get_node_exe
7+
NODE_EXE=`$GET_NODE_EXE`
68

7-
if [ -f "$HOME/.nodepath" ]; then
8-
NODE=`cat $HOME/.nodepath`/node;
9-
fi
10-
11-
$NODE -p 'process.alinode'
9+
$NODE_EXE -p 'process.alinode'

get_node_exe

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
if [ -x "$NODE_EXE" ] && [ -e "$NODE_EXE" ] ; then
4+
echo $NODE_EXE;
5+
elif [ -f "$HOME/.nodepath" ]; then
6+
echo `cat $HOME/.nodepath`/node;
7+
elif which node >/dev/null 2>&1; then
8+
echo `which node`;
9+
else
10+
echo "no available node";
11+
exit 1;
12+
fi

get_node_kill

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
if [ -x "$NODE_KILL" ] && [ -e "$NODE_KILL" ] ; then
4+
echo $NODE_KILL;
5+
elif [ -f "$HOME/.nodepath" ]; then
6+
echo `cat $HOME/.nodepath`/node-kill;
7+
elif which node-kill >/dev/null 2>&1; then
8+
echo `which node-kill`;
9+
else
10+
echo "no available node-kill";
11+
exit 1;
12+
fi
13+

get_node_version

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
export ENABLE_NODE_LOG=NO
44

5-
NODE=`which node`
5+
DIR=$(cd "$(dirname "$0")"; pwd)
6+
GET_NODE_EXE=$DIR/get_node_exe
7+
NODE_EXE=`$GET_NODE_EXE`
68

7-
if [ -f "$HOME/.nodepath" ]; then
8-
NODE=`cat $HOME/.nodepath`/node;
9-
fi
10-
11-
$NODE -v
9+
$NODE_EXE -v

get_os_info

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
export ENABLE_NODE_LOG=NO
44

5-
NODE=`which node`
5+
DIR=$(cd "$(dirname "$0")"; pwd)
6+
GET_NODE_EXE=$DIR/get_node_exe
7+
NODE_EXE=`$GET_NODE_EXE`
68

7-
if [ -f "$HOME/.nodepath" ]; then
8-
NODE=`cat $HOME/.nodepath`/node;
9-
fi
10-
11-
$NODE -e '
9+
$NODE_EXE -e '
1210
var os = require("os");
1311
console.log("%s/%s/%s/%s/%s", os.type(), os.hostname(), os.platform(), os.arch(), os.release());
1412
'

take_basic_prof

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#!/bin/sh
22

3-
NODE_KILL=`which node-kill`
4-
5-
if [ -f "$HOME/.nodepath" ]; then
6-
NODE_KILL=`cat $HOME/.nodepath`/node-kill;
7-
fi
3+
DIR=$(cd "$(dirname "$0")"; pwd)
4+
GET_NODE_KILL=$DIR/get_node_kill
5+
NODE_KILL=`$GET_NODE_KILL`
86

97
$NODE_KILL --v8-options --prof --prof_cpp --pid=$1

take_cpu_profile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#!/bin/sh
22

3-
NODE_KILL=`which node-kill`
4-
5-
if [ -f "$HOME/.nodepath" ]; then
6-
NODE_KILL=`cat $HOME/.nodepath`/node-kill;
7-
fi
3+
DIR=$(cd "$(dirname "$0")"; pwd)
4+
GET_NODE_KILL=$DIR/get_node_kill
5+
NODE_KILL=`$GET_NODE_KILL`
86

97
$NODE_KILL --start_profiling $1

take_gc_trace

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#!/bin/sh
22

3-
NODE_KILL=`which node-kill`
4-
5-
if [ -f "$HOME/.nodepath" ]; then
6-
NODE_KILL=`cat $HOME/.nodepath`/node-kill;
7-
fi
3+
DIR=$(cd "$(dirname "$0")"; pwd)
4+
GET_NODE_KILL=$DIR/get_node_kill
5+
NODE_KILL=`$GET_NODE_KILL`
86

97
$NODE_KILL --v8-options --trace_gc --pid=$1

take_gc_trace_verbose

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#!/bin/sh
22

3-
NODE_KILL=`which node-kill`
4-
5-
if [ -f "$HOME/.nodepath" ]; then
6-
NODE_KILL=`cat $HOME/.nodepath`/node-kill;
7-
fi
3+
DIR=$(cd "$(dirname "$0")"; pwd)
4+
GET_NODE_KILL=$DIR/get_node_kill
5+
NODE_KILL=`$GET_NODE_KILL`
86

97
$NODE_KILL --v8-options --trace_gc --trace_gc_nvp --trace_fragmentation --trace_gc_verbose --pid=$1

take_heapdump

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#!/bin/sh
22

3-
NODE_KILL=`which node-kill`
4-
5-
if [ -f "$HOME/.nodepath" ]; then
6-
NODE_KILL=`cat $HOME/.nodepath`/node-kill;
7-
fi
3+
DIR=$(cd "$(dirname "$0")"; pwd)
4+
GET_NODE_KILL=$DIR/get_node_kill
5+
NODE_KILL=`$GET_NODE_KILL`
86

97
$NODE_KILL --heapdump $1

0 commit comments

Comments
 (0)