diff --git a/README.md b/README.md index 06a5bbd..f85b9ac 100644 --- a/README.md +++ b/README.md @@ -203,13 +203,12 @@ const sandboxedCommand = await SandboxManager.wrapWithSandbox( // Execute the sandboxed command const child = spawn(sandboxedCommand, { shell: true, stdio: 'inherit' }) -// Handle exit -child.on('exit', code => { +// Handle exit and cleanup after child process completes +child.on('exit', async code => { console.log(`Command exited with code ${code}`) + // Cleanup when done (optional, happens automatically on process exit) + await SandboxManager.reset() }) - -// Cleanup when done (optional, happens automatically on process exit) -await SandboxManager.reset() ``` #### Available exports