温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/bun/Spawn/SpawnOptions/onDisconnect
点击访问原文链接

SpawnOptions.onDisconnect method | Bun module | Bun

SpawnOptions.onDisconnect method | Bun module | BunBuildDocsReferenceGuidesBlogDiscord/Bun/Spawn/SpawnOptions/onDisconnectMonDisconnect

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/Bun/Spawn/SpawnOptions/onDisconnectMonDisconnect

method

Spawn.SpawnOptions.onDisconnectonDisconnect(): void | Promisevoid>;

Called exactly once when the IPC channel between the parent and this subprocess is closed. After this runs, no further IPC messages will be delivered.

When it fires:

The child called process.disconnect() or the parent called subprocess.disconnect().The child exited for any reason (normal exit or due to a signal like SIGILL, SIGKILL, etc.).The child replaced itself with a program that does not support Bun IPC.

Notes:

This callback indicates that the pipe is closed; it is not an error by itself. Use onExit or Subprocess.exited to determine why the process ended.It may occur before or after onExit depending on timing; do not rely on ordering. Typically, if you or the child call disconnect() first, this fires before onExit; if the process exits without an explicit disconnect, either may happen first.Only runs when ipc is enabled and runs at most once per subprocess.If the child becomes a zombie (exited but not yet reaped), the IPC is already closed, and this callback will fire (or may already have fired).
const subprocess = spawn({
cmd: ["echo", "hello"],
ipc: (message) => console.log(message),
onDisconnect: () => {
console.log("IPC channel disconnected");
},
});

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicense

Baked with ❤️ in San Francisco

We're hiring →

SpawnOptions.onDisconnect method | Bun module | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    API documentation for method bun.Spawn.SpawnOptions.onDisconnect | Bun