-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathjavaArgs.js
More file actions
42 lines (32 loc) · 924 Bytes
/
Copy pathjavaArgs.js
File metadata and controls
42 lines (32 loc) · 924 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
32
33
34
35
36
37
38
39
40
41
42
'use strict';
let jar;
try {
jar = require('vnu-jar');
} catch {
throw new Error('vnu-jar is not installed. Run `npm install vnu-jar` to install it.');
}
// Determine proper jarfile arguments
function javaArgs(java, chunk, config) {
const args = [];
// Increase the default stack size for ia32 versions
if (java.arch === 'ia32') {
args.push('-Xss512k');
}
args.push(config.server ? '-cp' : '-jar', jar);
if (config.server) {
if (config.server.host) {
args.push(`-Dnu.validator.client.host=${config.server.host}`);
}
if (config.server.port) {
args.push(`-Dnu.validator.client.port=${config.server.port}`);
}
args.push('-Dnu.validator.client.out=json', 'nu.validator.client.HttpClient');
} else {
args.push('--format', 'json');
}
if (config.noLangDetect) {
args.push('--no-langdetect');
}
return [...args, ...chunk];
}
module.exports = javaArgs;