Skip to content

Commit

Permalink
Issue #1391580 by Garrett Albright: Fixed Stop trying to use wget if …
Browse files Browse the repository at this point in the history
…I don't have it on my machine.
  • Loading branch information
weitzman committed Jan 9, 2012
1 parent 02cef1e commit 015f41b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions includes/drush.inc
Expand Up @@ -822,13 +822,19 @@ function drush_download_file($url, $destination = FALSE, $cache_duration = 0) {
* downloaded.
*/
function _drush_download_file($url, $destination = FALSE, $overwrite = TRUE) {
static $use_wget;
if ($use_wget === NULL) {
$use_wget = drush_shell_exec('which wget');
}
if (!$destination) {
$destination = getcwd() . '/' . basename($url);
}

$destination_tmp = drush_tempnam('download_file');
drush_shell_exec("wget -q --timeout=30 -O %s %s", $destination_tmp, $url);
if (!drush_file_not_empty($destination_tmp)) {
if ($use_wget) {
drush_shell_exec("wget -q --timeout=30 -O %s %s", $destination_tmp, $url);
}
else {
drush_shell_exec("curl -s -L --connect-timeout 30 -o %s %s", $destination_tmp, $url);
}
if (!drush_file_not_empty($destination_tmp) && $file = @file_get_contents($url)) {
Expand Down

0 comments on commit 015f41b

Please sign in to comment.