Skip to content

Commit 9403130

Browse files
committed
feat: Added debug flag checking so inspect-brk can be used
1 parent 2466ae7 commit 9403130

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codify-plugin-test",
3-
"version": "0.0.33",
3+
"version": "0.0.46",
44
"description": "",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",

src/plugin-process.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,23 @@ export class PluginProcess {
3535
throw new Error('A fully qualified path must be supplied to PluginTester');
3636
}
3737

38+
const debug = (process.env.DEBUG) ? ['--inspect-brk=9221'] : [];
39+
3840
this.childProcess = fork(
3941
pluginPath,
4042
[],
4143
{
4244
// Use default true to test plugins in secure mode (un-able to request sudo directly)
4345
// detached: true,
4446
env: { ...process.env },
45-
execArgv: ['--import', 'tsx/esm'],
47+
execArgv: ['--import', 'tsx/esm', ...debug],
48+
stdio: 'pipe',
4649
},
4750
)
4851

52+
this.childProcess.stderr?.pipe(process.stderr);
53+
this.childProcess.stdout?.pipe(process.stdout);
54+
4955
this.handleSudoRequests(this.childProcess);
5056
}
5157

@@ -107,8 +113,6 @@ export class PluginProcess {
107113
}
108114

109115
const { command, options } = data as unknown as SudoRequestData;
110-
111-
console.log(`Running command with sudo: 'sudo ${command}'`)
112116
const result = await sudoSpawn(command, options);
113117

114118
process.send(<IpcMessageV2>{

0 commit comments

Comments
 (0)