diff --git a/scripts/continuum_save.sh b/scripts/continuum_save.sh index c85f68a..29b24ac 100755 --- a/scripts/continuum_save.sh +++ b/scripts/continuum_save.sh @@ -35,8 +35,11 @@ fetch_and_run_tmux_resurrect_save_script() { } main() { - if supported_tmux_version_ok && auto_save_not_disabled && enough_time_since_last_run_passed; then - fetch_and_run_tmux_resurrect_save_script - fi + ( + flock -n 101 || return # The code below is not thread-safe. + if supported_tmux_version_ok && auto_save_not_disabled && enough_time_since_last_run_passed; then + fetch_and_run_tmux_resurrect_save_script + fi + ) 101>/tmp/tmux-continuum-autosave.lockfile } main