# Options: -I <path> Specify path to kinit.
# -L <path> Specify path to klist.
# -R <path> Specify path to krenew.
+# -T <path> Specify path to tmux.
# Notes: Doesn't handle multiple sessions properly.
#
$tmux_helper = $$;
my %opts;
-getopts('I:L:R:', \%opts);
+getopts('I:L:R:T:', \%opts);
my $kinit = $opts{'I'} || "kinit";
my $klist = $opts{'L'} || "klist";
my $krenew = $opts{'R'} || "krenew";
+my $tmux = $opts{'T'} || "tmux";
+
+my $avoid_race = 0;
my $exitasap = 0;
my $pid = 0;
# We were signalled by our child which noticed that our credentials expired.
sub want_credentials {
+ return sleep 1 if $avoid_race;
+ $avoid_race = 1;
# Do we already know?
- return sleep 1 if &check_kinit_child;
- system "tmux", "new-window", "-n", "Renew Kerberos credentials", "exec $kinit";
+ system $tmux, "new-window", "-n", "Renew Kerberos credentials", "exec $kinit" unless &check_kinit_child;
+ sleep 1;
+ $avoid_race = 0;
}
sub cleanup {