my mods for watcher.pl take 1
This commit is contained in:
@@ -22,7 +22,7 @@ use Fcntl qw(O_RDWR O_NONBLOCK);
|
||||
use IO::Select;
|
||||
use POSIX qw(strftime mkfifo);
|
||||
|
||||
my $SCRIPT = '/home/vmarek/watcher.pl';
|
||||
my $SCRIPT = '/Users/jetpac/bin/watcher.pl';
|
||||
my $LINES = 20;
|
||||
my $COOLDOWN = $ENV{WATCHER_COOLDOWN} || 60;
|
||||
my $LOG_FILE = $ENV{WATCHER_LOG} || '';
|
||||
@@ -259,11 +259,9 @@ sub rendered_last_lines {
|
||||
|
||||
sub start_pipe {
|
||||
my ($sock, $pane, $event_path) = @_;
|
||||
my $cmd = shell_quote($^X) . ' ' .
|
||||
shell_quote($SCRIPT) . ' --watcher ' .
|
||||
shell_quote($sock) . ' ' .
|
||||
shell_quote($pane) . ' ' .
|
||||
shell_quote($event_path);
|
||||
my $cmd = join ' ',
|
||||
map { tmux_pipe_shell_quote($_) }
|
||||
($^X, $SCRIPT, '--watcher', $sock, $pane, $event_path);
|
||||
|
||||
return run_quiet(
|
||||
'tmux', '-S', $sock,
|
||||
@@ -372,6 +370,13 @@ sub shell_quote {
|
||||
return "'$s'";
|
||||
}
|
||||
|
||||
sub tmux_pipe_shell_quote {
|
||||
my ($s) = @_;
|
||||
# pipe-pane expands percent escapes in the shell command before execution.
|
||||
$s =~ s/%/%%/g;
|
||||
return shell_quote($s);
|
||||
}
|
||||
|
||||
sub log_msg {
|
||||
my ($msg) = @_;
|
||||
my $ts = strftime('%Y-%m-%dT%H:%M:%SZ', gmtime());
|
||||
|
||||
Reference in New Issue
Block a user