Add indepth languages analysis (#325)

This commit is contained in:
Simon Lecoq
2021-05-25 20:41:53 +02:00
committed by GitHub
parent 38e85eec11
commit 22d442a03c
5 changed files with 139 additions and 5 deletions

View File

@@ -131,7 +131,7 @@ export async function chartist() {
}
/**Run command */
export async function run(command, options, {prefixed = true} = {}) {
export async function run(command, options, {prefixed = true, log = true} = {}) {
const prefix = {win32:"wsl"}[process.platform] ?? ""
command = `${prefixed ? prefix : ""} ${command}`.trim()
return new Promise((solve, reject) => {
@@ -142,8 +142,10 @@ export async function run(command, options, {prefixed = true} = {}) {
child.stderr.on("data", data => stderr += data)
child.on("close", code => {
console.debug(`metrics/command > ${command} > exited with code ${code}`)
console.debug(stdout)
console.debug(stderr)
if (log) {
console.debug(stdout)
console.debug(stderr)
}
return code === 0 ? solve(stdout) : reject(stderr)
})
})