File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 3
3
### master
4
4
- to speed up the "online test" ping uses only 1 packet
5
5
- fix issue with status-right and status-left whitespace being cut out
6
+ - add ping default timeout (@mjwhitta )
6
7
7
8
### v1.0.0, 2014-10-26
8
9
- README updates
Original file line number Diff line number Diff line change @@ -4,12 +4,14 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4
4
5
5
online_option_string=" @online_icon"
6
6
offline_option_string=" @offline_icon"
7
+ ping_timeout_string=" @ping_timeout"
7
8
route_to_ping_string=" @route_to_ping"
8
9
9
10
online_icon_osx=" ✅ "
10
11
online_icon=" ✔ "
11
12
offline_icon_osx=" ⛔️ "
12
13
offline_icon=" ❌ "
14
+ ping_timeout_default=" 3"
13
15
route_to_ping_default=" www.google.com"
14
16
15
17
source $CURRENT_DIR /shared.sh
@@ -35,7 +37,14 @@ offline_icon_default() {
35
37
}
36
38
37
39
online_status () {
38
- ping -c 1 $( get_tmux_option " $route_to_ping_string " " $route_to_ping_default " ) > /dev/null 2>&1
40
+ if is_osx; then
41
+ local timeout_flag=" -t"
42
+ else
43
+ local timeout_flag=" -w"
44
+ fi
45
+ local ping_timeout=" $( get_tmux_option " $ping_timeout_string " " $ping_timeout_default " ) "
46
+ local ping_route=" $( get_tmux_option " $route_to_ping_string " " $route_to_ping_default " ) "
47
+ ping -c 1 " $timeout_flag " " $ping_timeout " " $ping_route " > /dev/null 2>&1
39
48
}
40
49
41
50
print_icon () {
You can’t perform that action at this time.
0 commit comments