Skip to content

Commit

Permalink
fix(bash): Silently fail if pkg-config bash-completion exists with non 0
Browse files Browse the repository at this point in the history
Meaning bash-completion is either not installed or misconfigured with
PKG_CONFIG_PATH. It'll fallback to only two possible installation, stdout and
~/.bashrc
  • Loading branch information
mklabs committed May 9, 2016
1 parent 35f158a commit 0765749
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,12 @@ export default class Installer {
var cmd = `pkg-config --variable=${variable} bash-completion`;
debug('cmd', cmd);
exec(cmd, function(err, stdout, stderr) {
if (err) return errback(err);
if (err) {
// silently fail if pkg-config bash-completion returns an error,
// meaning bash-completion is either not installed or misconfigured
// with PKG_CONFIG_PATH
return r();
}
stdout = stdout.trim();
debug('Got %s for %s', stdout, variable);
r(stdout);
Expand Down

2 comments on commit 0765749

@ChrisLCoray
Copy link

@ChrisLCoray ChrisLCoray commented on 0765749 May 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeoman recently (in the last 48 hours) cropped up with an issue, even on older (1.6.0 compared to the current 1.8.1) installs [EDIT: only happens on 1.8.0 and 1.8.1], Linux, where it hangs trying to install tabtab. I tried updating Yeoman on my local machine to 1.8.1 and I got the same error, and installing tabtab via npm install tabtab --save doesn't produce the same error.

Console output:
`> yo@1.8.1 tabtab /usr/local/lib/node_modules/yo

[ $CI ] || tabtab install --name=yo --completer=yo-complete

tabtab:installer Bash shell detected +0ms
tabtab:installer Asking pkg-config for completionsdir +2ms
tabtab:installer cmd +1ms pkg-config --variable=completionsdir bash-completion
tabtab:installer undefined +10ms
tabtab:installer Asking pkg-config for compatdir +1ms
tabtab:installer cmd +0ms pkg-config --variable=compatdir bash-completion
? Where do you want to setup the completion script (Use arrow keys)
❯ Nowhere. Just output to STDOUT
Bash config file (~/.bashrc)`

Once it reaches the ❯ Nowhere. Just output to STDOUT, it hangs indefinitely (or at least up to 45 minutes). The next line prints after I manually exit the process.

@mklabs
Copy link
Owner Author

@mklabs mklabs commented on 0765749 May 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChrisLCoray Thank you for reporting this. Trying to reproduce.

Please sign in to comment.