forked from openfoodfacts/openfoodfacts-server
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcompile_cgi.js
More file actions
31 lines (26 loc) · 728 Bytes
/
Copy pathcompile_cgi.js
File metadata and controls
31 lines (26 loc) · 728 Bytes
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
/*eslint no-console: "off"*/
/*eslint no-await-in-loop: "off"*/
/*global process*/
const util = require('util');
const glob = util.promisify(require('glob').glob);
const execFile = util.promisify(require('child_process').execFile);
async function main() {
const files = await glob('cgi/*.pl');
for (var i = 0; i < files.length; ++i) {
const path = files[i];
console.log(`Compiling ${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();