Skip to content

Commit ee50858

Browse files
committed
Add timeout
Don't want this action running forever if it is being ignored. Might be nice to add a way to prevent the timeout from occurring if the user is currently logged in.
1 parent 7d5cde8 commit ee50858

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

script.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ tmate -S /tmp/tmate.sock wait tmate-ready
2323
echo To connect to this session copy-n-paste the following into a terminal:
2424
tmate -S /tmp/tmate.sock display -p '#{tmate_ssh}'
2525

26-
# Wait for connection to close
26+
# Wait for connection to close or timeout in 15 min
27+
timeout=$((15*60))
2728
while [ -S /tmp/tmate.sock ]; do
2829
sleep 1
30+
timeout=$(($timeout-1))
31+
[ $timeout -gt 0 ] || exit 1
2932
done
30-

0 commit comments

Comments
 (0)