File tree 1 file changed +32
-0
lines changed
1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ if ! command -v fzf & > /dev/null; then
4
+ echo " The fzf command could not be found"
5
+ exit 1
6
+ fi
7
+
8
+ node_process_id=$( pgrep node)
9
+ node_process_count=$( pgrep node | wc -l | xargs)
10
+
11
+ if [ $node_process_count = 0 ]; then
12
+ exit 0
13
+ fi
14
+
15
+ if [ $node_process_count -gt 1 ]; then
16
+ export FZF_DEFAULT_OPTS=' --height=30% --layout=reverse --border --header-lines=1'
17
+ node_process_id=$( ps | awk ' NR==1 || $4 == "node"' | fzf | awk ' {print $1}' )
18
+
19
+ if [ -z $node_process_id ]; then
20
+ exit 0
21
+ fi
22
+ fi
23
+
24
+ kill -USR1 $node_process_id
25
+
26
+ if [ $? -eq 0 ]; then
27
+ echo " A debug signal to the node process (PID $node_process_id ) was sent."
28
+ exit 0
29
+ else
30
+ echo " The debug signal to the node process (PID $node_process_id ) could not be sent."
31
+ exit 1
32
+ fi
You can’t perform that action at this time.
0 commit comments