forked from openfoodfacts/openfoodfacts-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_perl.js
35 lines (30 loc) · 870 Bytes
/
check_perl.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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();