summaryrefslogtreecommitdiff
path: root/scripts/guix-retry
blob: c504048f45e0b0f7a4d014392c5bb3b391ba7902 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

error="write_to_session_record_port"

# create redirection
# file descripters
exec 11>&1 # stdout
exec 22>&2 # stderr

while true; do
	# send stdout to stdout
	# send stderr though pipe
	output=$("$@" 2>&1 1>&11 | tee >(cat - >&22)) # return stderr to
						      # normal stderr as well

	# check if error is in stderr
	if echo "$output" | grep -q "$error"; then
		continue
	fi
	break
done