@pushpalsdev/cli 1.1.17 → 1.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1213,16 +1213,7 @@ export class DockerExecutor {
|
|
|
1213
1213
|
);
|
|
1214
1214
|
await this.ensureWorktreeDependencyArtifacts(containerWorktreePath, onLog);
|
|
1215
1215
|
|
|
1216
|
-
const args
|
|
1217
|
-
"exec",
|
|
1218
|
-
"-w",
|
|
1219
|
-
containerWorktreePath,
|
|
1220
|
-
this.warmContainerName,
|
|
1221
|
-
"bun",
|
|
1222
|
-
"run",
|
|
1223
|
-
"/workspace/apps/workerpals/src/job_runner.ts",
|
|
1224
|
-
"--spec-stdin",
|
|
1225
|
-
];
|
|
1216
|
+
const args = this.buildWarmContainerExecArgs(containerWorktreePath);
|
|
1226
1217
|
|
|
1227
1218
|
console.log(
|
|
1228
1219
|
`[DockerExecutor] Running job in warm container: ${this.warmContainerName} (${this.executionConfigSummary()})`,
|
|
@@ -1321,26 +1312,62 @@ export class DockerExecutor {
|
|
|
1321
1312
|
return result;
|
|
1322
1313
|
}
|
|
1323
1314
|
|
|
1315
|
+
private buildWarmContainerExecArgs(containerWorktreePath: string): string[] {
|
|
1316
|
+
return [
|
|
1317
|
+
"exec",
|
|
1318
|
+
"-i",
|
|
1319
|
+
"-w",
|
|
1320
|
+
containerWorktreePath,
|
|
1321
|
+
this.warmContainerName,
|
|
1322
|
+
"bun",
|
|
1323
|
+
"run",
|
|
1324
|
+
"/workspace/apps/workerpals/src/job_runner.ts",
|
|
1325
|
+
"--spec-stdin",
|
|
1326
|
+
];
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1324
1329
|
private async writeJobSpecToStdin(
|
|
1325
1330
|
proc: ReturnType<typeof Bun.spawn>,
|
|
1326
1331
|
base64Spec: string,
|
|
1327
1332
|
): Promise<void> {
|
|
1328
|
-
const stdin = proc.stdin as
|
|
1333
|
+
const stdin = proc.stdin as
|
|
1334
|
+
| WritableStream<Uint8Array>
|
|
1335
|
+
| {
|
|
1336
|
+
write?: (chunk: Uint8Array | string) => unknown;
|
|
1337
|
+
end?: () => unknown;
|
|
1338
|
+
flush?: () => unknown;
|
|
1339
|
+
}
|
|
1340
|
+
| undefined;
|
|
1329
1341
|
if (!stdin) {
|
|
1330
1342
|
throw new Error("docker exec stdin pipe was not available");
|
|
1331
1343
|
}
|
|
1332
|
-
const
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
await writer.close();
|
|
1336
|
-
} catch (err) {
|
|
1344
|
+
const bytes = new TextEncoder().encode(base64Spec);
|
|
1345
|
+
if ("getWriter" in stdin && typeof stdin.getWriter === "function") {
|
|
1346
|
+
const writer = stdin.getWriter();
|
|
1337
1347
|
try {
|
|
1338
|
-
await writer.
|
|
1339
|
-
|
|
1340
|
-
|
|
1348
|
+
await writer.write(bytes);
|
|
1349
|
+
await writer.close();
|
|
1350
|
+
} catch (err) {
|
|
1351
|
+
try {
|
|
1352
|
+
await writer.abort(err);
|
|
1353
|
+
} catch {
|
|
1354
|
+
// Ignore abort failures; the original write error is more useful.
|
|
1355
|
+
}
|
|
1356
|
+
throw err;
|
|
1341
1357
|
}
|
|
1342
|
-
|
|
1358
|
+
return;
|
|
1343
1359
|
}
|
|
1360
|
+
|
|
1361
|
+
if (typeof stdin.write === "function" && typeof stdin.end === "function") {
|
|
1362
|
+
await stdin.write(bytes);
|
|
1363
|
+
if (typeof stdin.flush === "function") {
|
|
1364
|
+
await stdin.flush();
|
|
1365
|
+
}
|
|
1366
|
+
await stdin.end();
|
|
1367
|
+
return;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
throw new Error("docker exec stdin pipe does not support write/end or getWriter");
|
|
1344
1371
|
}
|
|
1345
1372
|
|
|
1346
1373
|
private async ensureWorktreeDependencyArtifacts(
|