@@ -87,14 +87,16 @@ def _download(path, url, probably_big, verbose, exception):
87
87
# If curl is not present on Win32, we should not sys.exit
88
88
# but raise `CalledProcessError` or `OSError` instead
89
89
require (["curl" , "--version" ], exception = platform_is_win32 )
90
- run (["curl" , option ,
91
- "-L" , # Follow redirect.
92
- "-y" , "30" , "-Y" , "10" , # timeout if speed is < 10 bytes/sec for > 30 seconds
93
- "--connect-timeout" , "30" , # timeout if cannot connect within 30 seconds
94
- "--retry" , "3" , "-Sf" , "-o" , path , url ],
95
- verbose = verbose ,
96
- exception = True , # Will raise RuntimeError on failure
97
- )
90
+ with open (path , "wb" ) as outfile :
91
+ run (["curl" , option ,
92
+ "-L" , # Follow redirect.
93
+ "-y" , "30" , "-Y" , "10" , # timeout if speed is < 10 bytes/sec for > 30 seconds
94
+ "--connect-timeout" , "30" , # timeout if cannot connect within 30 seconds
95
+ "--retry" , "3" , "-Sf" , url ],
96
+ stdout = outfile , #Implements cli redirect operator '>'
97
+ verbose = verbose ,
98
+ exception = True , # Will raise RuntimeError on failure
99
+ )
98
100
except (subprocess .CalledProcessError , OSError , RuntimeError ):
99
101
# see http://serverfault.com/questions/301128/how-to-download
100
102
if platform_is_win32 :
0 commit comments