ad377962dc
Fixes #1259 ## Problem The `CommandHandle.wait()` method fires `onStdout`, `onStderr`, and `onPty` callbacks without `await`, so async callbacks run as fire-and-forget microtasks. If a callback performs I/O (e.g. writing to a file, sending over network), `wait()` can resolve before the callback finishes, leading to lost data or race conditions. ## Fix Add `await` before each optional-chain callback invocation: ```diff -this.onStdout?.(stdout) +await this.onStdout?.(stdout) ``` This is fully backwards compatible — `await`-ing a sync function's return value is a no-op. ## Tests 3 parameterized test cases (`stdout`, `stderr`, `pty`) verify that `wait()` does not resolve until an async callback's promise settles. _This fix was developed with AI assistance and reviewed by a human._