File tree 1 file changed +9
-7
lines changed
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 14
14
fi
15
15
16
16
exit_watcher () {
17
- # we need to kill the parent process (rewatch)
18
- kill $( pgrep -P $! ) ;
17
+ # Try to find child process, if not found just kill the process directly
18
+ rm lib/rewatch.lock
19
19
}
20
20
21
- rewatch watch & > /dev/null &
22
- success " Watcher Started"
21
+ rewatch_bg watch > /dev/null 2>&1 &
22
+ echo " Started watcher in background "
23
23
24
24
sleep 1
25
25
26
- if rewatch watch 2>&1 | grep ' Could not start Rewatch:' & > /dev/null;
26
+ if rewatch watch | grep ' Could not start Rewatch:' & > /dev/null;
27
27
then
28
+ # rm output.txt
28
29
success " Lock is correctly set"
29
30
exit_watcher
30
31
else
32
+ # rm output.txt
31
33
error " Not setting lock correctly"
32
34
exit_watcher
33
35
exit 1
36
38
sleep 1
37
39
38
40
touch tmp.txt
39
- rewatch watch & > tmp.txt &
41
+ rewatch_bg watch > tmp.txt 2>&1 &
40
42
success " Watcher Started"
41
43
42
44
sleep 1
51
53
exit_watcher
52
54
fi
53
55
54
- rm tmp.txt
56
+ rm tmp.txt
You can’t perform that action at this time.
0 commit comments