agent-subprocess.sh 518 B

1234567891011121314151617181920212223
  1. # $OpenBSD: agent-subprocess.sh,v 1.1 2020/06/19 05:07:09 dtucker Exp $
  2. # Placed in the Public Domain.
  3. tid="agent subprocess"
  4. trace "ensure agent exits when run as subprocess"
  5. ${SSHAGENT} sh -c "echo \$SSH_AGENT_PID >$OBJ/pidfile; sleep 1"
  6. pid=$(cat $OBJ/pidfile)
  7. # Currently ssh-agent polls every 10s so we need to wait at least that long.
  8. n=12
  9. while kill -0 $pid > /dev/null 2>&1 && test "$n" -gt "0"; do
  10. n=$((n - 1))
  11. sleep 1
  12. done
  13. if test "$n" -eq "0"; then
  14. fail "agent still running"
  15. fi
  16. rm -f $OBJ/pidfile