Skip to content

Commit

Permalink
Merge pull request #136 from bkeepers/fix-linguist-command
Browse files Browse the repository at this point in the history
Fix linguist since command has been renamed
  • Loading branch information
cdelahousse committed Oct 11, 2018
2 parents 807e1f6 + 7c41faf commit 3385620
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/linguist.js
Expand Up @@ -11,12 +11,15 @@ class Linguist {
* Throws 'Linguist not installed' error if command line of 'linguist' is not available.
*/
identifyLanguagesSync (targetDir) {
const linguistOutput = spawnSync('linguist', [targetDir, '--json']).stdout
if (linguistOutput == null) {
throw new Error('Linguist not installed')
// Command was renamed in https://github.com/github/linguist/pull/4208
for (const command of ['github-linguist', 'linguist']) {
const output = spawnSync(command, [targetDir, '--json']).stdout
if (output !== null) {
return JSON.parse(output.toString())
}
}
const json = linguistOutput.toString()
return JSON.parse(json)

throw new Error('Linguist not installed')
}
}

Expand Down

0 comments on commit 3385620

Please sign in to comment.