Browse Source

master Fixed curl sometimes never ending

Mike Smith 11 years ago
parent
commit
660a66d51a
1 changed files with 3 additions and 2 deletions
  1. 3 2
      toolset/benchmark/framework_test.py

+ 3 - 2
toolset/benchmark/framework_test.py

@@ -860,19 +860,20 @@ class FrameworkTest:
   def __curl_url(self, url, testType, out, err):
   def __curl_url(self, url, testType, out, err):
     output = None
     output = None
     try:
     try:
+      # Use -m 15 to make curl stop trying after 15sec.
       # Use -i to output response with headers.
       # Use -i to output response with headers.
       # Don't use -f so that the HTTP response code is ignored.
       # Don't use -f so that the HTTP response code is ignored.
       # Use --stderr - to redirect stderr to stdout so we get
       # Use --stderr - to redirect stderr to stdout so we get
       # error output for sure in stdout.
       # error output for sure in stdout.
       # Use -sS to hide progress bar, but show errors.
       # Use -sS to hide progress bar, but show errors.
-      subprocess.check_call(["curl", "-i", "-sS", url], stderr=err, stdout=out)
+      subprocess.check_call(["curl", "-m", "15", "-i", "-sS", url], stderr=err, stdout=out)
       # HTTP output may not end in a newline, so add that here.
       # HTTP output may not end in a newline, so add that here.
       out.write( "\n\n" )
       out.write( "\n\n" )
       out.flush()
       out.flush()
       err.flush()
       err.flush()
 
 
       # We need to get the respond body from the curl and return it.
       # We need to get the respond body from the curl and return it.
-      p = subprocess.Popen(["curl", "-s", url], stdout=subprocess.PIPE)
+      p = subprocess.Popen(["curl", "-m", "15", "-s", url], stdout=subprocess.PIPE)
       output = p.communicate()
       output = p.communicate()
     except:
     except:
       pass
       pass