Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

feat(cli): honor NO_UPDATE_NOTIFIER to skip the update check (#1837)

Mish Ushakovb8b43232c885
diff --git a/.changeset/quiet-nix-notifier.md b/.changeset/quiet-nix-notifier.md
new file mode 100644
index 000000000..d991c85fb
--- /dev/null
+++ b/.changeset/quiet-nix-notifier.md
@@ -0,0 +1,5 @@
+---
+'@e2b/cli': patch
+---
+
+Skip the update check when the `NO_UPDATE_NOTIFIER` environment variable is set, so system package managers (for example Nix) can install the CLI without it suggesting updates they cannot apply. Help output now always names the program `e2b` instead of echoing the entrypoint file name.
diff --git a/packages/cli/src/commands/index.ts b/packages/cli/src/commands/index.ts
index 26f3221e2..0dcba975a 100644
--- a/packages/cli/src/commands/index.ts
+++ b/packages/cli/src/commands/index.ts
@@ -6,6 +6,9 @@ import { sandboxCommand } from './sandbox'
import { authCommand } from './auth'
export const program = new commander.Command()
+ // Fixed so help reads `e2b` however the entrypoint is invoked (npm bin
+ // symlink, `node dist/index.js`, or a distro wrapper script).
+ .name('e2b')
.enablePositionalOptions()
.description(
`Create sandbox templates from Dockerfiles by running ${asPrimary(
diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts
index 00ada9cc3..da0b5975b 100644
--- a/packages/cli/src/index.ts
+++ b/packages/cli/src/index.ts
@@ -8,14 +8,18 @@ import { commands2md } from './utils/commands2md'
export const pkg = packageJSON
-const updateCheck = simpleUpdateNotifier({
- pkg,
- updateCheckInterval: 1000 * 60 * 60 * 8, // 8 hours
-}).catch((e) => {
- if (process.env.DEBUG) {
- console.error('Update check failed:', e)
- }
-})
+// NO_UPDATE_NOTIFIER is the opt-out shared with `update-notifier`; distro
+// packagers set it because "install the new version" doesn't apply there.
+const updateCheck = process.env.NO_UPDATE_NOTIFIER
+ ? Promise.resolve()
+ : simpleUpdateNotifier({
+ pkg,
+ updateCheckInterval: 1000 * 60 * 60 * 8, // 8 hours
+ }).catch((e) => {
+ if (process.env.DEBUG) {
+ console.error('Update check failed:', e)
+ }
+ })
const prog = program.version(
packageJSON.version,