From eae3e3d284cb41b4366f7fcd0d29fe104083d426 Mon Sep 17 00:00:00 2001 From: Sami Tikka Date: Fri, 3 Feb 2012 00:08:30 +0200 Subject: [PATCH] osx: Fix for JENKINS-12622 - opening browser too early --- changelog.html | 4 ++++ osx/scripts/postinstall-launchd | 12 ++++++++++++ osx/scripts/postinstall-launchd-jenkins | 12 ++++++++++++ 3 files changed, 28 insertions(+) diff --git a/changelog.html b/changelog.html index 1397eaf7a5..fbc3b7a22e 100644 --- a/changelog.html +++ b/changelog.html @@ -61,6 +61,10 @@ Upcoming changes
  • Broken links to test results with '#' or '?' in the name (a href="https://issues.jenkins-ci.org/browse/JENKINS-10458">issue 10458) +
  • + Fix launching browser too early to http://localhost:8080 in OS X + installer. + (issue 12622) diff --git a/osx/scripts/postinstall-launchd b/osx/scripts/postinstall-launchd index 0a9cb23271..3f896396d4 100755 --- a/osx/scripts/postinstall-launchd +++ b/osx/scripts/postinstall-launchd @@ -10,3 +10,15 @@ find /Users/Shared/Jenkins \( -not -user daemon -or -not -group daemon \) -print # Load and start the launch daemon /bin/launchctl load -w ${JENKINS_PLIST} + +# Wait for port 8080 to start accepting connections. +# But don't wait forever. +timeout=$(($(date +%s) + 60)) +while [ $(date +%s) -lt $timeout ] && ! curl -s http://localhost:8080 >/dev/null; do + sleep 1 +done + +if [ $(date +%s) -ge $timeout ]; then + echo "Timed out waiting for Jenkins port 8080 to start listening!" + echo "Either Jenkins did not load or this system is very slow." +fi diff --git a/osx/scripts/postinstall-launchd-jenkins b/osx/scripts/postinstall-launchd-jenkins index fe147dd210..9e2db60159 100755 --- a/osx/scripts/postinstall-launchd-jenkins +++ b/osx/scripts/postinstall-launchd-jenkins @@ -42,3 +42,15 @@ find "$JENKINS_HOMEDIR" \( -not -user jenkins -or -not -group jenkins \) -print0 # Load and start the launch daemon /bin/launchctl load -w ${JENKINS_PLIST} + +# Wait for port 8080 to start accepting connections. +# But don't wait forever. +timeout=$(($(date +%s) + 60)) +while [ $(date +%s) -lt $timeout ] && ! curl -s http://localhost:8080 >/dev/null; do + sleep 1 +done + +if [ $(date +%s) -ge $timeout ]; then + echo "Timed out waiting for Jenkins port 8080 to start listening!" + echo "Either Jenkins did not load or this system is very slow." +fi -- GitLab