fix(pi-workflow): suppress verification bytecode

This commit is contained in:
jb
2026-08-25 20:19:53 -04:00
parent 141fcd145f
commit 8086247f26
3 changed files with 46 additions and 2 deletions
+23 -2
View File
@@ -23,8 +23,17 @@ export interface CommandResult {
stderr: string;
}
export interface CommandRunOptions {
env?: NodeJS.ProcessEnv;
}
export interface CommandRunner {
run(cwd: string, executable: string, args: string[]): Promise<CommandResult>;
run(
cwd: string,
executable: string,
args: string[],
options?: CommandRunOptions,
): Promise<CommandResult>;
}
export class WorkspaceSafetyError extends Error {
@@ -546,6 +555,12 @@ export class ApprovedHostCommandExecutor {
root,
options.executable,
[...options.args],
{
env: {
...process.env,
PYTHONDONTWRITEBYTECODE: "1",
},
},
);
try {
const afterRepository = await this.probe.captureRepository(root);
@@ -790,12 +805,18 @@ export class WorkspaceValidationError extends Error {
}
export class ExecFileCommandRunner implements CommandRunner {
async run(cwd: string, executable: string, args: string[]) {
async run(
cwd: string,
executable: string,
args: string[],
options: CommandRunOptions = {},
) {
try {
const result = await execFileAsync(executable, args, {
cwd,
encoding: "utf8",
maxBuffer: 4 * 1024 * 1024,
env: options.env,
});
return { code: 0, stdout: result.stdout, stderr: result.stderr };
} catch (error) {