-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathsass.ts
More file actions
executable file
·36 lines (30 loc) · 1.07 KB
/
sass.ts
File metadata and controls
executable file
·36 lines (30 loc) · 1.07 KB
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
#!/usr/bin/env node
import * as child_process from 'child_process';
import * as path from 'path';
import {compilerCommand} from '../lib/src/compiler-path';
// TODO npm/cmd-shim#152 and yarnpkg/berry#6422 - If and when the package
// managers support it, we should make this a proper shell script rather than a
// JS wrapper.
try {
let command = compilerCommand[0];
let args = [...compilerCommand.slice(1), ...process.argv.slice(2)];
const options: child_process.ExecFileSyncOptions = {
stdio: 'inherit',
windowsHide: true,
};
// Node forbids launching .bat and .cmd without a shell due to CVE-2024-27980,
// and DEP0190 forbids passing an argument list *with* shell: true. To work
// around this, we have to manually concatenate the arguments.
if (['.bat', '.cmd'].includes(path.extname(command).toLowerCase())) {
command = `${command} ${args.join(' ')}`;
args = [];
options.shell = true;
}
child_process.execFileSync(command, args, options);
} catch (error) {
if (error.code) {
throw error;
} else {
process.exitCode = error.status;
}
}