Skip to content

Commit

Permalink
schedule-tmux --remain: avoid set-remain-on-exit (tmux-2.4)
Browse files Browse the repository at this point in the history
  • Loading branch information
vaeth committed Apr 22, 2017
1 parent b29e264 commit c4463ac
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# ChangeLog for schedule

*schedule-v7.5.2:
Martin Väth <martin at mvath.de>:
- schedule-tmux --remain: Avoid set-remain-on-exit (for >=tmux-2.4)

*schedule-v7.5.1:
Martin Väth <martin at mvath.de>:
- zsh completion: Fix return value (needed for >=zsh-5.3)

*schedule-v7.5.0_p1:
Martin Väth <martin at mvath.de>:
- systemd: Add security options of systemd-232
Expand Down
21 changes: 11 additions & 10 deletions bin/schedule-tmux
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ case ${1-} in
remain=1
shift;;
esac
case $remain in
[nNfF0-]*|[oO][fF]*)
remainA=
remainB=;;
*)
remainA='set-option set-remain-on-exit on ;'
remainB='; set-option set-remain-on-exit off';;
esac

# Check whether the command is appropriate, and possibly print a manpage:
schedule --check "$@"
Expand All @@ -37,9 +29,18 @@ tmux wait-for $$ &

# Now we open a new window in which we output the command and run schedule
# with a value of -a which will end our waiting task above.
# In case of remain, we additionally store the number of that window
# and set remain-on-exit for it.

tmux $remainA new-window -d "schedule quote schedule $cmd
schedule -a \"tmux wait-for -S $$\" $cmd" $remainB
case $remain in
[nNfF0-]*|[oO][fF]*)
tmux new-window -d "schedule quote schedule $cmd
schedule -a \"tmux wait-for -S $$\" $cmd";;
*)
window=`tmux new-window -Pd "schedule quote schedule $cmd
schedule -a \"tmux wait-for -S $$\" $cmd"`
tmux set-window-option -t "$window" remain-on-exit on;;
esac

# Now we wait for the end of our above task: When this task finishes,
# we can be sure that the passed command has been queued.
Expand Down
2 changes: 1 addition & 1 deletion share/schedule/Schedule/Connect.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# common parts of schedule and schedule-server which are always needed

BEGIN { require 5.012 }
package Schedule::Connect v7.5.1;
package Schedule::Connect v7.5.2;

use strict;
use warnings;
Expand Down

0 comments on commit c4463ac

Please sign in to comment.