Skip to content

Commit b2cf887

Browse files
committed
fix(js-sdk): use commands.run in Sandbox.getHost() example
The getHost() JSDoc @example called sandbox.commands.exec(), which is not a method on the Commands class (it exposes run()), so copy-pasting the snippet threw "TypeError: sandbox.commands.exec is not a function". Switch it to sandbox.commands.run(), matching the sibling example in the same file and the Python SDK. Documentation only, no behavior change. Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
1 parent 423a1b7 commit b2cf887

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"e2b": patch
3+
---
4+
5+
Fix the `Sandbox.getHost()` documentation example so it can be copy-pasted. The `@example` called `sandbox.commands.exec(...)`, which is not a method on the `Commands` class (it exposes `run`), so running the snippet threw `TypeError: sandbox.commands.exec is not a function`. It now uses `sandbox.commands.run(...)`, matching the other examples in the SDK. Documentation only, no behavior change.

packages/js-sdk/src/sandbox/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ export class Sandbox extends SandboxApi {
425425
* ```ts
426426
* const sandbox = await Sandbox.create()
427427
* // Start an HTTP server
428-
* await sandbox.commands.exec('python3 -m http.server 3000')
428+
* await sandbox.commands.run('python3 -m http.server 3000')
429429
* // Get the hostname of the HTTP server
430430
* const serverURL = sandbox.getHost(3000)
431431
* ```

0 commit comments

Comments
 (0)