Skip to content

Commit 3777a66

Browse files
committed
vnu-jar.mjs: improve script
1 parent 86f0f8f commit 3777a66

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

scripts/vnu-jar.mjs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
/*!
44
* Script to run vnu-jar if Java is available.
5-
* Copyright 2017-2024 The Bootstrap Authors
5+
* Copyright 2017-2026 The Bootstrap Authors
66
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
77
*/
88

99
import { execFile, spawn } from 'node:child_process'
1010
import vnu from 'vnu-jar'
1111

12-
execFile('java', ['-version'], (error, stdout, stderr) => {
12+
execFile('java', ['-version'], (error, _stdout, stderr) => {
1313
if (error) {
1414
console.error('Skipping vnu-jar test; Java is probably missing.')
1515
console.error(error)
@@ -18,7 +18,7 @@ execFile('java', ['-version'], (error, stdout, stderr) => {
1818

1919
console.log('Running vnu-jar validation...')
2020

21-
const is32bitJava = !/64-Bit/.test(stderr)
21+
const is32bitJava = !stderr.includes('64-Bit')
2222

2323
// vnu-jar accepts multiple ignores joined with a `|`.
2424
// Also note that the ignores are string regular expressions.
@@ -30,11 +30,12 @@ execFile('java', ['-version'], (error, stdout, stderr) => {
3030

3131
const args = [
3232
'-jar',
33-
`"${vnu}"`,
33+
String(vnu),
3434
'--asciiquotes',
3535
'--skip-non-html',
3636
'--Werror',
37-
`--filterpattern "${ignores}"`,
37+
'--filterpattern',
38+
ignores,
3839
'_site/'
3940
]
4041

@@ -46,7 +47,6 @@ execFile('java', ['-version'], (error, stdout, stderr) => {
4647
console.log(`command used: java ${args.join(' ')}`)
4748

4849
return spawn('java', args, {
49-
shell: true,
5050
stdio: 'inherit'
5151
})
5252
.on('exit', process.exit)

0 commit comments

Comments
 (0)