Skip to content

Commit

Permalink
fix(container): handle missing docker install
Browse files Browse the repository at this point in the history
  • Loading branch information
elbandito authored Oct 31, 2018
1 parent 6dbc23f commit cf45581
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/container-registry-v5/commands/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async function login (context, heroku) {
try {
await dockerLogin(registry, password)
} catch (err) {
cli.error(`Error: docker login exited with ${err}`, 1)
cli.error(`Login failed with: ${err.message}`, 1)
}
}

Expand Down
10 changes: 9 additions & 1 deletion packages/container-registry-v5/lib/sanbashi.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,16 @@ Sanbashi.cmd = function (cmd, args, options = {}) {
stdout += data.toString()
})
}
child.on('error', (err) => {
if (err.code === 'ENOENT' && err.path === 'docker') {
reject(new Error(`Cannot find docker, please ensure docker is installed.
If you need help installing docker, visit https://docs.docker.com/install/#supported-platforms`))
} else {
reject(err)
}
})
child.on('exit', (code, signal) => {
if (signal || code) reject(signal || code)
if (signal || code) reject(new Error(signal || code))
else resolve(stdout)
})
})
Expand Down

0 comments on commit cf45581

Please sign in to comment.