@mastra/e2b 0.16.1-alpha.0 → 0.16.1
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/dist/index.cjs +24 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -1
- package/dist/index.js.map +1 -1
- package/dist/sandbox/filesystem.d.ts +2 -2
- package/dist/sandbox/process-manager.d.ts +2 -2
- package/package.json +10 -10
- /package/dist/_types/{@internal_workspace → @internal_workspace@0.0.20}/dist/commands-api-process-manager.d.ts +0 -0
- /package/dist/_types/{@internal_workspace → @internal_workspace@0.0.20}/dist/file-commands.d.ts +0 -0
- /package/dist/_types/{@internal_workspace → @internal_workspace@0.0.20}/dist/files-api-filesystem.d.ts +0 -0
- /package/dist/_types/{@internal_workspace → @internal_workspace@0.0.20}/dist/index.d.ts +0 -0
- /package/dist/_types/{@internal_workspace → @internal_workspace@0.0.20}/dist/repo-clone.d.ts +0 -0
- /package/dist/_types/{@internal_workspace → @internal_workspace@0.0.20}/dist/setup-marker.d.ts +0 -0
- /package/dist/_types/{@internal_workspace → @internal_workspace@0.0.20}/package.json +0 -0
package/dist/index.js
CHANGED
|
@@ -527,6 +527,20 @@ var FilesApiFilesystem = class extends MastraFilesystem {
|
|
|
527
527
|
throw new Error(`${operation} ${subject} failed (exit ${result.exitCode}): ${result.stderr.trim()}`);
|
|
528
528
|
}
|
|
529
529
|
};
|
|
530
|
+
const KILL_DESCENDANTS_TIMEOUT_MS = 1e4;
|
|
531
|
+
/**
|
|
532
|
+
* A shell command that kills every process `pid` started, at any depth, but
|
|
533
|
+
* not `pid` itself. It pauses `pid` first: a wrapper like npm exits on its own
|
|
534
|
+
* once its child dies, and `kill(pid)` would then report it wasn't running.
|
|
535
|
+
*/
|
|
536
|
+
function killDescendants(pid) {
|
|
537
|
+
return [
|
|
538
|
+
`kill -STOP ${pid}`,
|
|
539
|
+
"kill_children() { for child in $(pgrep -P \"$1\"); do kill -STOP \"$child\"; (kill_children \"$child\"); kill -KILL \"$child\"; done; }",
|
|
540
|
+
`kill_children ${pid}`,
|
|
541
|
+
"true"
|
|
542
|
+
].join("\n");
|
|
543
|
+
}
|
|
530
544
|
/**
|
|
531
545
|
* Output callbacks for `run`/`connect` that hold output until the handle
|
|
532
546
|
* exists. The SDK's handle reads events from construction, before `run()`
|
|
@@ -629,7 +643,16 @@ var CommandsApiProcessHandle = class extends ProcessHandle {
|
|
|
629
643
|
}
|
|
630
644
|
async kill() {
|
|
631
645
|
if (this.exitCode !== void 0) return false;
|
|
632
|
-
return this.manager.runCommands("kill", (commands) =>
|
|
646
|
+
return this.manager.runCommands("kill", async (commands) => {
|
|
647
|
+
try {
|
|
648
|
+
await (await commands.run(killDescendants(this.inner.pid), {
|
|
649
|
+
background: true,
|
|
650
|
+
stdin: false,
|
|
651
|
+
timeoutMs: KILL_DESCENDANTS_TIMEOUT_MS
|
|
652
|
+
})).wait();
|
|
653
|
+
} catch {}
|
|
654
|
+
return commands.kill(this.inner.pid);
|
|
655
|
+
});
|
|
633
656
|
}
|
|
634
657
|
async sendStdin(data) {
|
|
635
658
|
if (this.exitCode !== void 0) throw new Error(`Process ${this.pid} has already exited with code ${this.exitCode}`);
|