Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(759)

Unified Diff: src/scripts/remote_access.sh

Issue 560005: Make run_remote_test's use of ssh-agent more predictable. (Closed)
Patch Set: addressed style comments Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/scripts/run_remote_tests.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scripts/remote_access.sh
diff --git a/src/scripts/remote_access.sh b/src/scripts/remote_access.sh
index 8b1a733340fc00303369a67e69b799ef4c5a6fc9..43a64ad1875e8b64fc8bc33f540f84bdfe0820de 100644
--- a/src/scripts/remote_access.sh
+++ b/src/scripts/remote_access.sh
@@ -25,6 +25,9 @@ function remote_sh_allow_changed_host_key() {
function set_up_remote_access() {
if [ -z "$SSH_AGENT_PID" ]; then
eval $(ssh-agent)
+ OWN_SSH_AGENT=1
+ else
+ OWN_SSH_AGENT=0
fi
cp $FLAGS_private_key $TMP_PRIVATE_KEY
chmod 0400 $TMP_PRIVATE_KEY
@@ -36,6 +39,17 @@ function set_up_remote_access() {
echo "Connection OK"
}
+function cleanup_remote_access() {
+ # Call this function from the exit trap of the main script.
+ # Iff we started ssh-agent, be nice and clean it up.
+ # Note, only works if called from the main script - no subshells.
+ if [[ 1 -eq ${OWN_SSH_AGENT} ]]
+ then
+ kill ${SSH_AGENT_PID} 2>/dev/null
+ unset SSH_AGENT_PID SSH_AUTH_SOCK
+ fi
+}
+
function remote_access_init() {
TMP_PRIVATE_KEY=$TMP/private_key
TMP_KNOWN_HOSTS=$TMP/known_hosts
« no previous file with comments | « no previous file | src/scripts/run_remote_tests.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698