1 parent
eeec91e892
commit
a3cdcc7796
2 files changed
+4
-4
No files matched your search
@@ -21,7 +21,7 @@ export async function sandboxWorkerMain(): Promise<void> {
|
||||
try {
|
||||
const req = JSON.parse(await new Response(Deno.stdin.readable).text()) as { job: string; input: unknown };
|
||||
const fn = (SANDBOX_JOBS as Record<string, (i: unknown) => unknown>)[req.job];
|
||||
if (!fn) throw new Error(`没有这个沙箱任务:${req.job}`);
|
||||
if (!fn) throw new Error(`没有这个沙箱任务:${req.job}`);
|
||||
out = { ok: true, result: await fn(req.input) };
|
||||
} catch (e) {
|
||||
out = { ok: false, error: `${(e as Error).name}: ${(e as Error).message}`.slice(0, 2000) };
|
||||
|
||||
Reference in new issue
Block a user