diff options
Diffstat (limited to 'regress/agent-subprocess.sh')
-rw-r--r-- | regress/agent-subprocess.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/regress/agent-subprocess.sh b/regress/agent-subprocess.sh new file mode 100644 index 000000000..2f36d70cc --- /dev/null +++ b/regress/agent-subprocess.sh | |||
@@ -0,0 +1,22 @@ | |||
1 | # $OpenBSD: agent-subprocess.sh,v 1.1 2020/06/19 05:07:09 dtucker Exp $ | ||
2 | # Placed in the Public Domain. | ||
3 | |||
4 | tid="agent subprocess" | ||
5 | |||
6 | trace "ensure agent exits when run as subprocess" | ||
7 | ${SSHAGENT} sh -c "echo \$SSH_AGENT_PID >$OBJ/pidfile; sleep 1" | ||
8 | |||
9 | pid=`cat $OBJ/pidfile` | ||
10 | |||
11 | # Currently ssh-agent polls every 10s so we need to wait at least that long. | ||
12 | n=12 | ||
13 | while kill -0 $pid >/dev/null 2>&1 && test "$n" -gt "0"; do | ||
14 | n=$(($n - 1)) | ||
15 | sleep 1 | ||
16 | done | ||
17 | |||
18 | if test "$n" -eq "0"; then | ||
19 | fail "agent still running" | ||
20 | fi | ||
21 | |||
22 | rm -f $OBJ/pidfile | ||