Fix post installation 'hang' bug, simplify daemon start

pull/184/head
Simon Let 3 years ago
parent cb5e01bd07
commit 4383d2b30a
  1. 6
      Makefile
  2. 1
      scripts/hooks.sh
  3. 16
      scripts/install.sh
  4. 2
      scripts/resh-daemon-start.sh
  5. 8
      scripts/reshctl.sh
  6. 5
      scripts/shellrc.sh
  7. 16
      scripts/util.sh

@ -9,7 +9,12 @@ build: submodules bin/resh-session-init bin/resh-collect bin/resh-postcollect\
bin/resh-daemon bin/resh-control bin/resh-config bin/resh-cli\
bin/resh-install-utils bin/resh-generate-uuid bin/resh-get-epochtime
# we disable jobserver for the actual installation because we want it to run serially
# Make waits to the daemon process we launch during install and hangs
install: build
make -j1 _install
_install:
scripts/install.sh
test:
@ -35,7 +40,6 @@ bin/resh-%: $(go_files)
.PHONY: submodules build install rebuild uninstall clean test
submodules: | submodules/bash-preexec/bash-preexec.sh submodules/bash-zsh-compat-widgets/bindfunc.sh
@# sets submodule.recurse to true if unset
@# sets status.submoduleSummary to true if unset

@ -37,7 +37,6 @@ __resh_collect() {
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})"
fi
fi
# TODO: change how resh-uuid is read
if [ "$__RESH_VERSION" = "$(resh-collect -version)" ] && [ "$__RESH_REVISION" = "$(resh-collect -revision)" ]; then
resh-collect -requireVersion "$__RESH_VERSION" \
-requireRevision "$__RESH_REVISION" \

@ -109,6 +109,7 @@ cp -f submodules/bash-preexec/bash-preexec.sh ~/.bash-preexec.sh
cp -f submodules/bash-zsh-compat-widgets/bindfunc.sh ~/.resh/bindfunc.sh
cp -f scripts/shellrc.sh ~/.resh/shellrc
cp -f scripts/resh-daemon-start.sh ~/.resh/bin/resh-daemon-start
cp -f scripts/reshctl.sh scripts/widgets.sh scripts/hooks.sh scripts/util.sh ~/.resh/
cp -f scripts/rawinstall.sh ~/.resh/
@ -126,11 +127,15 @@ if [ ! -f "$pid_file" ]; then
pid_file=~/.resh/resh.pid
fi
failed_to_kill() {
echo "ERROR: Failed to kill the resh-daemon - maybe it wasn't running?"
}
if [ -f "$pid_file" ]; then
kill -SIGTERM "$pid_file"
kill -SIGKILL "$pid_file" || failed_to_kill
rm "$pid_file"
else
pkill -SIGTERM "resh-daemon"
pkill -SIGKILL "resh-daemon" || failed_to_kill
fi
echo "Creating/updating config file ..."
@ -161,13 +166,8 @@ fi
# Deleting zsh completion cache - for future use
# [ ! -e ~/.zcompdump ] || rm ~/.zcompdump
# Source utils to get __resh_run_daemon function
# shellcheck source=util.sh
. ~/.resh/util.sh
echo "Launching resh daemon ..."
__resh_run_daemon
~/.resh/bin/resh-daemon-start
info="---- Scroll down using arrow keys ----
#####################################

@ -0,0 +1,2 @@
#! /usr/bin/env sh
nohup resh-daemon >/dev/null 2>/dev/null & disown

@ -50,14 +50,6 @@ __resh_unbind_control_R() {
return 0
}
__resh_bind_all() {
__resh_bind_control_R
}
__resh_unbind_all() {
__resh_unbind_control_R
}
# wrapper for resh-cli for calling resh directly
resh() {
local buffer

@ -1,9 +1,6 @@
#!/hint/sh
PATH=$PATH:~/.resh/bin
# if [ -n "$ZSH_VERSION" ]; then
# zmodload zsh/datetime
# fi
# shellcheck source=hooks.sh
. ~/.resh/hooks.sh
@ -31,7 +28,7 @@ export __RESH_VERSION=$(resh-collect -version)
# shellcheck disable=2155
export __RESH_REVISION=$(resh-collect -revision)
__resh_run_daemon
resh-daemon-start
[ "$(resh-config --key BindControlR)" = true ] && __resh_bind_control_R

@ -2,22 +2,6 @@
# util.sh - resh utility functions
# FIXME: figure out if stdout/stderr should be discarded
__resh_run_daemon() {
if [ -n "${ZSH_VERSION-}" ]; then
setopt LOCAL_OPTIONS NO_NOTIFY NO_MONITOR
fi
if [ "$(uname)" = Darwin ]; then
# hotfix
gnohup resh-daemon >/dev/null 2>/dev/null & disown
else
# TODO: switch to nohup for consistency once you confirm that daemon is
# not getting killed anymore on macOS
nohup resh-daemon >/dev/null 2>/dev/null & disown
#setsid resh-daemon 2>&1 & disown
fi
}
__resh_session_init() {
if [ "$__RESH_VERSION" != "$(resh-session-init -version)" ]; then
# shellcheck source=shellrc.sh

Loading…
Cancel
Save