+# Try to check existing Kerberos credentials.
+sub check_credentials {
+ system $klist, "-s";
+ return 1 if $? < 0;
+ return 0 unless $?;
+ kill USR1, $tmux_helper;
+ return 111;
+}
+
+# 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?
+ system $tmux, "new-window", "-n", "Renew Kerberos credentials", "exec $kinit" unless &check_kinit_child;
+ sleep 1;
+ $avoid_race = 0;
+}
+