feat(runtime): default to passthrough and persist execution permissions
This commit is contained in:
@@ -5,6 +5,7 @@ import { createHash, randomUUID } from 'node:crypto';
|
||||
import { execFile } from 'node:child_process';
|
||||
import { promisify } from 'node:util';
|
||||
import { projectEnvironment } from './process-environment.mjs';
|
||||
import { ceiling } from '../shared/contracts/execution-policy.mjs';
|
||||
|
||||
const executeFile = promisify(execFile);
|
||||
const digest = bytes => createHash('sha256').update(bytes).digest('hex');
|
||||
@@ -105,9 +106,9 @@ export async function preparePythonInvocation(check, project, { signal } = {}) {
|
||||
} };
|
||||
}
|
||||
|
||||
export function readPythonEvidence(invocation, exitCode) {
|
||||
export function readPythonEvidence(invocation, exitCode, config = {}) {
|
||||
if (!fs.existsSync(invocation.resultPath)) throw new Error('Python进程未返回结构化结果,日志文字不能代替测试统计。');
|
||||
if (fs.statSync(invocation.resultPath).size > 2 * 1024 * 1024) throw new Error('Python结构化结果超过读取上限。');
|
||||
if (fs.statSync(invocation.resultPath).size > ceiling(config, 2 * 1024 * 1024)) throw new Error('Python结构化结果超过读取上限。');
|
||||
const text = fs.readFileSync(invocation.resultPath, 'utf8'), result = JSON.parse(text);
|
||||
validatePythonEvidence(result, invocation, exitCode);
|
||||
return { result, text };
|
||||
|
||||
Reference in New Issue
Block a user