Skip to content

Commit

Permalink
Fix sandbox kill command (e2b-dev#344)
Browse files Browse the repository at this point in the history
CLI `e2b sandbox kill` command didn't work with sandboxIDs provided by
the `e2b sandbox list`. This PR fixes that.
  • Loading branch information
ValentaTomas authored Mar 27, 2024
2 parents 13c499c + 3b41654 commit f511678
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/sweet-masks-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@e2b/cli": patch
---

Fix CLI kill sandbox command
6 changes: 1 addition & 5 deletions packages/cli/src/commands/sandbox/kill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import { ensureAPIKey } from 'src/api'
import { asBold } from 'src/utils/format'
import * as e2b from 'e2b'


const killSandbox = e2b.withAPIKey(
e2b.api.path('/sandboxes/{sandboxID}').method('delete').create(),
)
export const killCommand = new commander.Command('kill')
.description('kill sandbox')
.argument('<sandboxID>', `kill the sandbox specified by ${asBold('<sandboxID>')}`)
Expand All @@ -21,7 +17,7 @@ export const killCommand = new commander.Command('kill')
process.exit(1)
}

await killSandbox(apiKey, { sandboxID })
await e2b.Sandbox.kill(sandboxID, apiKey)

console.log(`Sandbox ${asBold(sandboxID)} has been killed`)
} catch (err: any) {
Expand Down

0 comments on commit f511678

Please sign in to comment.