fix worker forreal
Build and Push Spoon Images / quality (push) Successful in 1m45s
Build and Push Spoon Images / build-images (push) Successful in 7m35s

This commit is contained in:
Gabriel Brown
2026-06-23 21:38:41 -04:00
parent c3d265d428
commit 30a17196f5
5 changed files with 169 additions and 39 deletions
+18 -3
View File
@@ -54,6 +54,7 @@ export const runInJobContainer = async (args: {
{
all: true,
reject: false,
stdin: 'ignore',
timeout: args.timeoutMs,
},
);
@@ -102,7 +103,7 @@ export const startWorkspaceContainer = async (args: {
env.jobImage,
...(args.command ?? ['sleep', 'infinity']),
],
{ all: true },
{ all: true, stdin: 'ignore' },
);
return {
containerId: result.stdout.trim(),
@@ -117,7 +118,7 @@ const getPublishedPort = async (containerName: string, containerPort: number) =>
const result = await execa(
containerRuntime(),
['port', containerName, `${containerPort}/tcp`],
{ all: true, reject: false },
{ all: true, reject: false, stdin: 'ignore' },
);
const output = result.all.trim();
const match = /:(\d+)\s*$/.exec(output);
@@ -147,6 +148,7 @@ export const execInWorkspaceContainer = async (args: {
{
all: true,
reject: false,
stdin: 'ignore',
timeout: args.timeoutMs,
},
);
@@ -186,6 +188,7 @@ export const streamInJobContainer = async (args: {
{
all: true,
reject: false,
stdin: 'ignore',
timeout: args.timeoutMs,
},
);
@@ -220,7 +223,19 @@ export const streamInJobContainer = async (args: {
consume(chunk, 'stderr', args.onStderrLine),
);
});
const result = await subprocess;
let result: Awaited<typeof subprocess>;
try {
result = await subprocess;
} catch (error) {
await lineHandlers;
const outputText = output.join('');
const message =
error instanceof Error ? error.message : 'Container command failed.';
return {
exitCode: 1,
output: args.redact(`${outputText}${outputText ? '\n' : ''}${message}`),
};
}
await lineHandlers;
if (stdoutBuffer && args.onStdoutLine) {
await args.onStdoutLine(args.redact(stdoutBuffer));