Skip to content

Commit

Permalink
Merge branch 'master' into shiftkey-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftkey committed Nov 22, 2017
2 parents e6219d5 + 72488b1 commit 31d7474
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docs/environment-variables.md
Expand Up @@ -14,6 +14,10 @@ should be cached to speed up testing.
If this is not specified, it will fallback to [`os.tmpdir()`](https://nodejs.org/dist/latest-v8.x/docs/api/os.html#os_os_tmpdir)
which is provided by Node.

If you are connected to the internet using a proxy, make sure that `HTTP_PROXY`
and `HTTPS_PROXY` are configured correctly. Otherwise the installation will fail
with a connection error. For more information see: [Controlling proxy behaviour using environment variables](https://github.com/request/request#controlling-proxy-behaviour-using-environment-variables)

## Execution

If you have a separate Git distribution you would prefer to use with `dugite`,
Expand Down
15 changes: 12 additions & 3 deletions script/download-git.js
Expand Up @@ -10,8 +10,8 @@ const zlib = require('zlib')

const config = require('./config')()

function extract (source, callback) {
const extractor = tar.Extract({path: config.outputPath})
function extract(source, callback) {
const extractor = tar.Extract({ path: config.outputPath })
.on('error', function (error) { callback(error) })
.on('end', function () { callback() })

Expand Down Expand Up @@ -60,7 +60,16 @@ const downloadAndUnpack = () => {
req.pipe(fs.createWriteStream(config.tempFile))

req.on('error', function (error) {
console.log(`Error raised while downloading ${config.source}`, error)
if (error.code === 'ETIMEDOUT') {
console.log(
`A timeout has occurred while downloading '${config.source}' - check ` +
`your internet connection and try again. If you are using a proxy, ` +
`make sure that the HTTP_PROXY and HTTPS_PROXY environment variables are set.`,
error
)
} else {
console.log(`Error raised while downloading ${config.source}`, error)
}
process.exit(1)
})

Expand Down

0 comments on commit 31d7474

Please sign in to comment.