fix(node): mirror Grok hook loader contract
This commit is contained in:
1 parent
d627b784f2
commit
f01fd92946
7 files changed
+120
-10
No files matched your search
@@ -16,14 +16,15 @@ export const installationModuleUrl = pathToFileURL(
|
||||
).href;
|
||||
export const cliPath = path.resolve('dist/cli.js');
|
||||
|
||||
export function runNode(args, env, cwd, input = '', unset = []) {
|
||||
export function runProcess(command, args, env, cwd, input = '', unset = []) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const childEnv = { ...process.env, ...env };
|
||||
for (const key of unset) delete childEnv[key];
|
||||
const child = spawn(process.execPath, args, {
|
||||
const child = spawn(command, args, {
|
||||
cwd,
|
||||
env: childEnv,
|
||||
stdio: ['pipe', 'pipe', 'pipe'],
|
||||
windowsHide: true,
|
||||
});
|
||||
let stdout = '';
|
||||
let stderr = '';
|
||||
@@ -35,6 +36,10 @@ export function runNode(args, env, cwd, input = '', unset = []) {
|
||||
});
|
||||
}
|
||||
|
||||
export function runNode(args, env, cwd, input = '', unset = []) {
|
||||
return runProcess(process.execPath, args, env, cwd, input, unset);
|
||||
}
|
||||
|
||||
export function runGrokHook(command, input, fixture, environment = {}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const child = spawn(command, {
|
||||
|
||||
Reference in new issue
Block a user