Skip to content

Commit

Permalink
Re-add check_perl.js
Browse files Browse the repository at this point in the history
  • Loading branch information
hangy committed Nov 12, 2019
1 parent 910210a commit 67a2b69
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions check_perl.js
@@ -0,0 +1,35 @@
/*eslint no-console: "off"*/
/*eslint no-await-in-loop: "off"*/
/*global process*/

const process = require('process');
const util = require('util');
const glob = util.promisify(require('glob').glob);
const execFile = util.promisify(require('child_process').execFile);

async function main() {
// 0 = node; 1 = check_perl.js
for (let arg of process.argv.slice(2)) {
const files = await glob(arg);
for (var i = 0; i < files.length; ++i) {
const path = files[i];
console.log(`Checking ${path}`);
try {
const { stdout, stderr } = await execFile(`perl`, ['-c', '-CS', '-Ilib', files[i]]);
if (stderr) {
console.error(stderr);
}

console.log(stdout);
} catch (e) {
console.error(e);
process.exitCode = e.code;
throw e;
}
}
}

console.log('Done!');
}

main();

0 comments on commit 67a2b69

Please sign in to comment.