Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/Misc/layoutroot/safe_sleep.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
#!/bin/bash

SECONDS=0
while [[ $SECONDS != $1 ]]; do

# Bash 4.0 and above supports read.
if [[ -n "$BASH_VERSINFO" && "${BASH_VERSINFO[0]}" -ge 4 ]]; then
echo foo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo foo

Remove debug logs

# Bash has no sleep builtin, but read with a timeout can behave in same way.
read -rt "$1" <> <(:) || :
fi
# Fallback to busy wait.
while [[ $SECONDS -lt $1 ]]; do
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

echo bar
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo bar

Same here

:
done