Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/reset socket #112

Merged
merged 10 commits into from
Feb 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 91 additions & 77 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,159 +23,173 @@ matrix:
## CASES are generated by pict and Pairwise technique. Refer to ./test/travis.pict.

- os: linux
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=1.8 CASES=13,15,16,26,39,47,63,64
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=1.8 CASES=5,7,18,20,25,40,42,44
- os: linux
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=1.9 CASES=14,20,24,27,41,44
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=1.9 CASES=8,10,11,20,26,29,46,55,60,64
- os: linux
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=1.9a CASES=1,3,19,22,30,48,56
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=1.9a CASES=12,13,20,22,27,47,61
- os: linux
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=2.0 CASES=5,6,29,34,35,42,45,63
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=2.0 CASES=2,9,15,37,38,44,49,61
- os: linux
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=2.1 CASES=2,9,16,19,28,44,50,52
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=2.1 CASES=14,16,21,45,55,56
- os: linux
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=2.2 CASES=10,24,26,28,40,45,53,57,60
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=2.2 CASES=3,4,5,8,11,13,17,35,36,53,54,57
- os: linux
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=2.3 CASES=19,20,23,32,33,55,58,59,64,65
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=2.3 CASES=8,30,39,41,45,63,65
- os: linux
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=2.4 CASES=11,17,22,26,31,37,38,40
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=2.4 CASES=3,11,14,23,32,37,46,64
- os: linux
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=2.5 CASES=2,4,5,7,12,25,32,33,54,61
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=2.5 CASES=1,8,21,22,25,28,42,51,66
- os: linux
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=2.6 CASES=21,43,44,49,51,62
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=2.6 CASES=6,21,24,37,40,42,43,54
- os: linux
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=2.7 CASES=1,8,9,18,22,36,46,61,66
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=2.7 CASES=7,17,19,31,32,34,35,43,46,47,48,52,53,62
- os: linux
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=1.8 CASES=4,5,8,9,27,42,60
env: SH=bash SH_VERSION=3.2 TMUX_VERSION=2.8 CASES=2,8,9,20,23,33,35,37,50,56,58,59
- os: linux
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=1.9 CASES=4,7,19,21,23,37,40,49,56,57,61
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=1.8 CASES=16,17,21,27,45,48,63
- os: linux
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=1.9a CASES=7,12,18,31,32,41,47,51,52,54
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=1.9 CASES=1,2,5,9,19,22,23,24,25,34,38,51
- os: linux
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=2.0 CASES=14,39,40,43,48,52
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=1.9a CASES=7,18,26,30,36,43,44,51,63
- os: linux
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=2.1 CASES=3,7,12,25,30,32,40,42,48,63,64
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=2.0 CASES=1,4,12,14,28,41,45
- os: linux
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=2.2 CASES=6,11,12,14,20,23,33,34,46,49,54,61
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=2.1 CASES=1,13,15,26,29,32,43,49,53,54
- os: linux
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=2.3 CASES=1,3,5,17,26,28,29,34,44,48,63
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=2.2 CASES=14,20,28,32,34,42,47,48,56,60
- os: linux
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=2.4 CASES=8,10,16,25,27,42,46,50,59
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=2.3 CASES=14,21,23,37,58,59,64
- os: linux
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=2.5 CASES=11,14,15,18,22,24,34,35,38,45,46,48,55,66
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=2.4 CASES=6,8,9,31,33,66
- os: linux
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=2.6 CASES=13,18,30,35,36,45,47,63
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=2.5 CASES=6,9,16,30,35,40,43,46
- os: linux
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=2.7 CASES=2,16,19,37,38,53,58,62,65
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=2.6 CASES=11,18,20,23,25,30,33,36,41,50,52,55,65
- os: linux
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=1.8 CASES=17,19,23,29,36,38,44,57
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=2.7 CASES=5,10,13,24,62,64
- os: linux
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=1.9 CASES=12,18,29,32,34,45,48,51,52,60,63,64
env: SH=bash SH_VERSION=4.0 TMUX_VERSION=2.8 CASES=3,6,11,15,39,43,53,57,61
- os: linux
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=1.9a CASES=6,8,9,25,27,33,42,46,50,53,64
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=1.8 CASES=11,29,55,57
- os: linux
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=2.0 CASES=11,20,26,33,38,41,57
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=1.9 CASES=7,33,43,44,56,57
- os: linux
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=2.1 CASES=4,5,6,10,21,23,24,43,51,55,56
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=1.9a CASES=8,15,21,23,34,42,49
- os: linux
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=2.2 CASES=2,7,16,30,31,41,43,44,47,50,56
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=2.0 CASES=6,10,13,16,21,25,32,35,36,46,47,50,52,55
- os: linux
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=2.3 CASES=12,14,15,16,21,22,30,35,47
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=2.1 CASES=4,10,18,22,31,36,40
- os: linux
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=2.4 CASES=9,13,28,29,45,49,57,58,61,65
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=2.2 CASES=9,18,25,37,41,45,51
- os: linux
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=2.5 CASES=8,9,10,16,23,31,37,57
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=2.3 CASES=15,17,20,24,32,35,40,48
- os: linux
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=2.6 CASES=1,4,19,24,32,34,40,41,54,62
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=2.4 CASES=2,5,13,19,20,26,39,48,50,51,58,63
- os: linux
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=2.7 CASES=3,21,33,39,42,45,49,55,59,63,66
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=2.5 CASES=3,7,12,14,15,24,39,53,54,56,59
- os: linux
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=1.8 CASES=12,14,22,30,33,40,48,55
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=2.6 CASES=5,38,39,49,57,62,64,65,66
- os: linux
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=1.9 CASES=5,8,16,28,31,38,50,53,54
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=2.7 CASES=1,27,28,61
- os: linux
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=1.9a CASES=2,10,15,17,37,43
env: SH=bash SH_VERSION=4.1 TMUX_VERSION=2.8 CASES=4,29,30,40,44,55,60
- os: linux
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=2.0 CASES=3,10,13,31,32,37,46,54,60,61
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=1.8 CASES=1,8,9,10,12,26,35,37,38,39,41,43,60
- os: linux
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=2.1 CASES=13,18,26,31,38,46
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=1.9 CASES=14,21,30,48,61
- os: linux
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=2.2 CASES=4,8,9,18,21,25,36,39,42
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=1.9a CASES=1,4,5,10,19,29,39,40,52,54,55,56
- os: linux
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=2.3 CASES=11,13,40,45,58
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=2.0 CASES=7,11,19,20,30,31,39,48,54
- os: linux
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=2.4 CASES=1,2,4,20,21,33,34,35,41,53,63
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=2.1 CASES=7,12,17,24,25,46,51,52,61,64
- os: linux
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=2.5 CASES=6,19,20,27,29,30,41,43,47,49,51
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=2.2 CASES=15,16,19,22,23,26,27,46
- os: linux
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=2.6 CASES=3,9,17,28,52,56,57,61,65,66
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=2.3 CASES=18,27,28,34,42,43,46,66
- os: linux
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=2.7 CASES=6,7,14,23,24,30,34,44,59,62,64
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=2.4 CASES=4,7,15,35,36,45,57,59,61,65
- os: linux
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=1.8 CASES=7,10,18,25,35
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=2.5 CASES=2,4,29,34,38,47,49,55,61,63,64
- os: linux
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=1.9 CASES=2,3,15,17,22,35,36,39,42,46,55
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=2.6 CASES=3,8,10,12,13,15,22,32,35,53,58
- os: linux
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=1.9a CASES=4,16,21,35,44,49,57,60,63
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=2.7 CASES=6,12,22,25,29,33,37,44,50
- os: linux
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=2.0 CASES=8,22,24,28,30,44,47,53
env: SH=bash SH_VERSION=4.2 TMUX_VERSION=2.8 CASES=7,16,17,21,27,28,32,42,62
- os: linux
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=2.1 CASES=1,8,15,29,34,36,37,39,41,45,47,61
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=1.8 CASES=4,14,19,24,33,36,47,61,64
- os: linux
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=2.2 CASES=5,13,19,22,29,32,48,51,52,55
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=1.9 CASES=12,15,16,35,36,37,49,53,63
- os: linux
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=2.3 CASES=9,24,27,31,38
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=1.9a CASES=3,17,25,60,64
- os: linux
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=2.4 CASES=6,14,18,43,54,64,65
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=2.0 CASES=8,23,29,42,51,56
- os: linux
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=2.5 CASES=1,26,56,58,64,66
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=2.1 CASES=2,3,5,6,19,20,23,28,30,33,34,37,39,47,57,63
- os: linux
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=2.6 CASES=5,7,15,23,27,33,37,42,48,50,62
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=2.2 CASES=1,2,21,24,31,33,50,52,63
- os: linux
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=2.7 CASES=11,12,15,20,26,29,35,40,43,59
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=2.3 CASES=4,5,9,10,22,33,55
- os: linux
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=1.8 CASES=1,11,20,34,37,41,43,45,61
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=2.4 CASES=22,24,28,29,30,40,41,43,44,47,52,53
- os: linux
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=1.9 CASES=6,26,33
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=2.5 CASES=10,11,13,31,32,44,48
- os: linux
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=1.9a CASES=5,11,26,39,40,55
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=2.6 CASES=1,2,7,9,14,16,19,26,27,28,31,46,58
- os: linux
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=2.0 CASES=1,4,9,12,15,18,19,21,25,50,56
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=2.7 CASES=4,14,16,18,38,39,40,42,54,59
- os: linux
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=2.1 CASES=14,17,20,35,49,53,57
env: SH=bash SH_VERSION=4.3 TMUX_VERSION=2.8 CASES=10,26,38,45,47,51,62,65,66
- os: linux
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=2.2 CASES=3,27,38,60
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=1.8 CASES=3,22,23,28,46
- os: linux
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=2.3 CASES=4,25,36,37,43,46,58
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=1.9 CASES=3,4,6,13,17,27,47,50,52
- os: linux
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=2.4 CASES=3,7,23,24,30,32,47,56,66
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=1.9a CASES=6,14,24,28,31,32,33,35,37,41,45,50,57
- os: linux
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=2.5 CASES=13,21,28,39,42,44,52,63,65
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=2.0 CASES=3,27,34,40,43,53,60,64
- os: linux
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=2.6 CASES=2,8,10,12,14,16,20,22,25,29,31,46,55,59,62,64
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=2.1 CASES=8,9,11,27,38,42,44,48
- os: linux
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=2.7 CASES=10,13,25,27,41,48,50,51,54,57
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=2.2 CASES=10,12,29,30,38,39,40,55,61
- os: linux
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=1.8 CASES=3,21,24,28,46
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=2.3 CASES=7,11,12,16,19,25,26,29,36,47,57
- os: linux
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=1.9 CASES=1,9,10,11,13,25,30,43,47
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=2.4 CASES=1,16,18,21,42,49,54,55
- os: linux
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=1.9a CASES=13,14,20,23,24,28,29,34,36,38,45,61
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=2.5 CASES=5,17,18,26,33,36,45,50,58
- os: linux
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=2.0 CASES=2,7,16,17,23,27,36,49,51,55,64
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=2.6 CASES=34,44,45,48,51,56,59,63
- os: linux
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=2.1 CASES=11,22,27,33,54,60
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=2.7 CASES=2,11,15,20,23,36,49,56,62,63,65,66
- os: linux
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=2.2 CASES=1,15,17,35,37,63,64
env: SH=bash SH_VERSION=4.4 TMUX_VERSION=2.8 CASES=1,5,12,18,24,25,31,41,46,48,54,64
- os: linux
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=2.3 CASES=7,8,10,18,39,41,42,57,66
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=1.8 CASES=13,15,30,34
- os: linux
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=2.4 CASES=5,12,15,19,36,39,44,48,51,52,55,65
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=1.9 CASES=18,28,31,32,39,40,41,42,45,54
- os: linux
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=2.5 CASES=3,17,36,40,50,53,59
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=1.9a CASES=2,9,11,16,38,46,48,53
- os: linux
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=2.6 CASES=6,11,26,38,39,53,58,62
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=2.0 CASES=5,17,18,22,24,26,33,57,63
- os: linux
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=2.7 CASES=4,5,17,28,31,32,47,52,56
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=2.1 CASES=35,41,50,60
- os: linux
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=2.2 CASES=6,7,43,44,49,64
- os: linux
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=2.3 CASES=1,3,13,31,38,44
- os: linux
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=2.4 CASES=10,12,17,25,27,34,38,56
- os: linux
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=2.5 CASES=19,20,23,27,37,41,52,57,65,66
- os: linux
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=2.6 CASES=4,17,29,47,61
- os: linux
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=2.7 CASES=3,8,9,21,26,30,41,45,51,55,57,58,62
- os: linux
env: SH=bash SH_VERSION=5.0 TMUX_VERSION=2.8 CASES=13,14,19,22,34,36,49,52,59,63

before_script:
- export TMPDIR=$TRAVIS_BUILD_DIR/tmp
Expand Down
41 changes: 39 additions & 2 deletions bin/xpanes
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ readonly XP_SHELL="/bin/bash"

set -u
readonly XP_VERSION="3.1.0"
trap 'rm -f "${XP_CACHE_HOME}"/__xpns_*$$' EXIT
trap 'rm -f "${XP_CACHE_HOME}"/__xpns_*$$; rm -f "${XP_DEFAULT_SOCKET_PATH}"' EXIT

## --------------------------------
# Error constants
Expand Down Expand Up @@ -103,7 +103,9 @@ XP_OPT_DRY_RUN=0
XP_OPT_ATTACH=1
XP_OPT_LOG_STORE=0
XP_REPSTR=""
XP_SOCKET_PATH="${XP_SOCKET_PATH:-${XP_CACHE_HOME}/socket}"
XP_DEFAULT_SOCKET_PATH_BASE="${XP_CACHE_HOME}/socket"
XP_DEFAULT_SOCKET_PATH="${XP_DEFAULT_SOCKET_PATH_BASE}.$$"
XP_SOCKET_PATH="${XP_SOCKET_PATH:-${XP_DEFAULT_SOCKET_PATH}}"
XP_NO_OPT=0
XP_OPT_CMD_UTILITY=0
XP_CMD_UTILITY=""
Expand Down Expand Up @@ -746,6 +748,38 @@ xpns_extra_panes_to_window() {
"$@"
}

# Remove unnecessary session files as much as possible
# to let xpanes avoids to load old .tmux.conf.
xpns_clean_session() {
local _xpns_pid
local _pattern
if ! type ls > /dev/null 2>&1 ;then
return
fi
if [[ "${XP_SOCKET_PATH}" != "${XP_DEFAULT_SOCKET_PATH}" ]]; then
return
fi
# Delete old socket file (xpanes v3.1.0 or before).
if [[ -e "${XP_DEFAULT_SOCKET_PATH_BASE}" ]]; then
xpns_msg_debug "xpns_clean_session: Remove ${XP_DEFAULT_SOCKET_PATH_BASE}"
rm -f "${XP_DEFAULT_SOCKET_PATH_BASE}"
fi
for _socket in "${XP_CACHE_HOME}"/* ;do
xpns_msg_debug "xpns_clean_session: file = ${_socket}"
_pattern="socket.([0-9]+)$"
if [[ "${_socket}" =~ $_pattern ]]; then
_xpns_pid="${BASH_REMATCH[1]}"
# Check whether the process is running or not
if ! builtin kill -0 "${_xpns_pid}" > /dev/null 2>&1 ;then
xpns_msg_debug "xpns_clean_session: pid(${_xpns_pid}) is not running. Remove ${_socket}"
rm -f "${_socket}"
else
xpns_msg_debug "xpns_clean_session: pid(${_xpns_pid}) is running. Keep ${_socket}"
fi
fi
done
}

#
# Split a new window which was created by tmux into multiple panes.
# Usage:
Expand Down Expand Up @@ -867,6 +901,9 @@ xpns_pre_execution() {
fi
_args4args=$(xpns_arr2args "${XP_ARGS[@]}")

# Run as best effort
xpns_clean_session || true

# Create new session.
${TMUX_XPANES_EXEC} -S "${XP_SOCKET_PATH}" new-session \
-s "${XP_SESSION_NAME}" \
Expand Down
2 changes: 1 addition & 1 deletion test/travis.pict
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## $ pict travis.pict | sed 1d | sort -k1,2 -k3n | awk '{a[$1" "$2]=a[$1" "$2]" "$3}END{for(k in a){print k" "a[k]}}' | sort -k1,1 | perl -anle 'print "- os: linux\n env: SH=bash SH_VERSION=$F[0] TMUX_VERSION=$F[1] CASES=@{[join \",\", @F[2..$#F]]}"' | sed 's/^/ /'

bash:3.2,4.0,4.1,4.2,4.3,4.4,5.0
tmux:1.8,1.9,1.9a,2.0,2.1,2.2,2.3,2.4,2.5,2.6,2.7
tmux:1.8,1.9,1.9a,2.0,2.1,2.2,2.3,2.4,2.5,2.6,2.7,2.8

## Create test cases
# cat cases_all.sh | grep '@case:' | awk '{print $NF}' | xargs | tr ' ' ',' | awk '{print "case:"$0}'
Expand Down
46 changes: 38 additions & 8 deletions test/unitTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ fi
# Directory name of this file
readonly THIS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-${(%):-%N}}")" && pwd)"

BIN_DIR="${THIS_DIR}/../bin/"
# Get repository name which equals to bin name.
# BIN_NAME="$(basename $(git rev-parse --show-toplevel))"
BIN_NAME="xpanes"
EXEC="${BIN_DIR}${BIN_NAME}"

# shellcheck source=/dev/null
source "${EXEC}" --dry-run -- -
oneTimeSetUp(){
BIN_DIR="${THIS_DIR}/../bin/"
# Get repository name which equals to bin name.
# BIN_NAME="$(basename $(git rev-parse --show-toplevel))"
BIN_NAME="xpanes"
EXEC="${BIN_DIR}${BIN_NAME}"
export XDG_CACHE_HOME="${SHUNIT_TMPDIR}/spa ce/.cache"
export XP_CACHE_HOME="${XDG_CACHE_HOME}/xpanes"
# shellcheck source=/dev/null
source "${EXEC}" --dry-run -- -
}

setUp(){
echo ">>>>>>>>>>" >&2
Expand Down Expand Up @@ -171,5 +174,32 @@ test_xpns_is_valid_layout() {
assertEquals "$expected" "$actual"
}

test_xpns_clean_session() {
touch "${XP_CACHE_HOME}/socket"
xpns_clean_session
# echo "Remove socket"
[[ -e "${XP_CACHE_HOME}/socket" ]]
actual=$?
expected=1
assertEquals "$expected" "$actual"

touch "${XP_CACHE_HOME}/socket.$$"
touch "${XP_CACHE_HOME}/socket.01234"
xpns_clean_session

# echo "Keep ${XP_CACHE_HOME}/socket.$$"
[[ -e "${XP_CACHE_HOME}/socket.$$" ]]
actual=$?
expected=0
assertEquals "$expected" "$actual"

# echo "Remove ${XP_CACHE_HOME}/socket.01234"
[[ -e "${XP_CACHE_HOME}/socket.01234" ]]
actual=$?
expected=1
assertEquals "$expected" "$actual"
}


# shellcheck source=/dev/null
. "${THIS_DIR}/shunit2/source/2.1/src/shunit2"