File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,7 +9,12 @@ build: submodules bin/resh-session-init bin/resh-collect bin/resh-postcollect\
99 bin/resh-daemon bin/resh-control bin/resh-config bin/resh-cli\
1010 bin/resh-install-utils bin/resh-generate-uuid bin/resh-get-epochtime
1111
12+ # we disable jobserver for the actual installation because we want it to run serially
13+ # Make waits to the daemon process we launch during install and hangs
1214install : build
15+ make -j1 _install
16+
17+ _install :
1318 scripts/install.sh
1419
1520test :
@@ -35,7 +40,6 @@ bin/resh-%: $(go_files)
3540
3641.PHONY : submodules build install rebuild uninstall clean test
3742
38-
3943submodules : | submodules/bash-preexec/bash-preexec.sh submodules/bash-zsh-compat-widgets/bindfunc.sh
4044 @# sets submodule.recurse to true if unset
4145 @# sets status.submoduleSummary to true if unset
Original file line number Diff line number Diff line change @@ -37,7 +37,6 @@ __resh_collect() {
3737 echo " RESH WARNING: You probably just updated RESH - PLEASE RESTART OR RELOAD THIS TERMINAL SESSION (resh revision: $( resh-collect -revision) ; resh revision of this terminal session: ${__RESH_REVISION} )"
3838 fi
3939 fi
40- # TODO: change how resh-uuid is read
4140 if [ " $__RESH_VERSION " = " $( resh-collect -version) " ] && [ " $__RESH_REVISION " = " $( resh-collect -revision) " ]; then
4241 resh-collect -requireVersion " $__RESH_VERSION " \
4342 -requireRevision " $__RESH_REVISION " \
@@ -51,9 +50,9 @@ __resh_collect() {
5150 -gitRemote " $__RESH_GIT_REMOTE " \
5251 -time " $__RESH_RT_BEFORE " \
5352 " $@ "
54- return $?
55- fi
56- return 1
53+ return $?
54+ fi
55+ return 1
5756}
5857
5958__resh_precmd () {
Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ cp -f submodules/bash-preexec/bash-preexec.sh ~/.bash-preexec.sh
109109cp -f submodules/bash-zsh-compat-widgets/bindfunc.sh ~ /.resh/bindfunc.sh
110110
111111cp -f scripts/shellrc.sh ~ /.resh/shellrc
112+ cp -f scripts/resh-daemon-start.sh ~ /.resh/bin/resh-daemon-start
112113cp -f scripts/reshctl.sh scripts/widgets.sh scripts/hooks.sh scripts/util.sh ~ /.resh/
113114cp -f scripts/rawinstall.sh ~ /.resh/
114115
@@ -126,11 +127,15 @@ if [ ! -f "$pid_file" ]; then
126127 pid_file=~ /.resh/resh.pid
127128fi
128129
130+ failed_to_kill () {
131+ echo " ERROR: Failed to kill the resh-daemon - maybe it wasn't running?"
132+ }
133+
129134if [ -f " $pid_file " ]; then
130- kill -SIGTERM " $pid_file "
135+ kill -SIGKILL " $pid_file " || failed_to_kill
131136 rm " $pid_file "
132137else
133- pkill -SIGTERM " resh-daemon"
138+ pkill -SIGKILL " resh-daemon" || failed_to_kill
134139fi
135140
136141echo " Creating/updating config file ..."
161166# Deleting zsh completion cache - for future use
162167# [ ! -e ~/.zcompdump ] || rm ~/.zcompdump
163168
164- # Source utils to get __resh_run_daemon function
165- # shellcheck source=util.sh
166- . ~ /.resh/util.sh
167-
168169echo " Launching resh daemon ..."
169- __resh_run_daemon
170-
170+ ~ /.resh/bin/resh-daemon-start
171171
172172info=" ---- Scroll down using arrow keys ----
173173#####################################
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env sh
2+ nohup resh-daemon > /dev/null 2> /dev/null & disown
Original file line number Diff line number Diff line change @@ -50,14 +50,6 @@ __resh_unbind_control_R() {
5050 return 0
5151}
5252
53- __resh_bind_all () {
54- __resh_bind_control_R
55- }
56-
57- __resh_unbind_all () {
58- __resh_unbind_control_R
59- }
60-
6153# wrapper for resh-cli for calling resh directly
6254resh () {
6355 local buffer
Original file line number Diff line number Diff line change 11#! /hint/sh
22
33PATH=$PATH :~ /.resh/bin
4- # if [ -n "$ZSH_VERSION" ]; then
5- # zmodload zsh/datetime
6- # fi
74
85# shellcheck source=hooks.sh
96. ~ /.resh/hooks.sh
@@ -31,7 +28,7 @@ export __RESH_VERSION=$(resh-collect -version)
3128# shellcheck disable=2155
3229export __RESH_REVISION=$( resh-collect -revision)
3330
34- __resh_run_daemon
31+ resh-daemon-start
3532
3633[ " $( resh-config --key BindControlR) " = true ] && __resh_bind_control_R
3734
Original file line number Diff line number Diff line change 22
33# util.sh - resh utility functions
44
5- # FIXME: figure out if stdout/stderr should be discarded
6- __resh_run_daemon () {
7- if [ -n " ${ZSH_VERSION-} " ]; then
8- setopt LOCAL_OPTIONS NO_NOTIFY NO_MONITOR
9- fi
10- if [ " $( uname) " = Darwin ]; then
11- # hotfix
12- gnohup resh-daemon > /dev/null 2> /dev/null & disown
13- else
14- # TODO: switch to nohup for consistency once you confirm that daemon is
15- # not getting killed anymore on macOS
16- nohup resh-daemon > /dev/null 2> /dev/null & disown
17- # setsid resh-daemon 2>&1 & disown
18- fi
19- }
20-
215__resh_session_init () {
226 if [ " $__RESH_VERSION " != " $( resh-session-init -version) " ]; then
237 # shellcheck source=shellrc.sh
You can’t perform that action at this time.
0 commit comments