Skip to content

Commit a5d66aa

Browse files
authored
Merge pull request #89 from perfectra1n/master
Fix log messages when attempting to rebuild the plugin, and detect if the binary already exists to trigger rebuild.
2 parents bc279dd + b0644d7 commit a5d66aa

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

tmux-mem-cpu-load.plugin.tmux

+26-9
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,32 @@
1818
# The directory where this plugin is located.
1919
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
2020

21-
pushd $CURRENT_DIR #Pushd to the directory where this plugin is located.
21+
if [ ! -f $CURRENT_DIR/tmux-mem-cpu-load ] && ! $(builtin type -P "tmux-mem-cpu-load" &> /dev/null) ; then
22+
tmux run-shell "echo \"tmux-mem-cpu-load not found. Attempting to build.
23+
\""
2224

23-
# Attempt to rebuild the plugin and log any errors in the tmux display window.
24-
if output=$(cmake . 2>&1); then tmux run-shell "echo \"'cmake $CURRENT_DIR' failed.
25-
$output
26-
\""; else exit 1; fi
25+
pushd $CURRENT_DIR #Pushd to the directory where this plugin is located.
2726

28-
if output=$(make 2>&1); then tmux run-shell "echo \"tmux-mem-cpu-load failed to build.
29-
$output
30-
\""; else exit 1; fi
27+
# Attempt to rebuild the plugin and log any errors in the tmux display window.
28+
if output=$(cmake . 2>&1); then
29+
tmux run-shell "echo \"'cmake $CURRENT_DIR' completed successfully.
30+
\""
31+
else
32+
tmux run-shell "echo \"'cmake $CURRENT_DIR' failed. Error logged below.
33+
$output
34+
\""
35+
exit 1
36+
fi
37+
38+
if output=$(make 2>&1); then
39+
tmux run-shell "echo \"tmux-mem-cpu-load built successfully.
40+
\""
41+
else
42+
tmux run-shell "echo \"tmux-mem-cpu-load failed to build. Error logged below.
43+
$output
44+
\""
45+
exit 1
46+
fi
47+
popd
48+
fi
3149

32-
popd

0 commit comments

Comments
 (0)