Commit c3f2d39

Anton Medvedev <anton@medv.io>
2022-06-07 19:13:31
Use global var ZX_VERBOSE instead of env
1 parent ae0f0cf
Changed files (2)
src/core.ts
@@ -56,7 +56,7 @@ function syncCwd() {
 
 function initStore(): Options {
   const context = {
-    verbose: true,
+    verbose: (global as any).ZX_VERBOSE ?? true,
     cwd: process.cwd(),
     env: process.env,
     shell: true,
@@ -66,7 +66,6 @@ function initStore(): Options {
     log,
   }
   storage.enterWith(context)
-  if (process.env.ZX_VERBOSE) $.verbose = process.env.ZX_VERBOSE == 'true'
   try {
     $.shell = which.sync('bash')
     $.prefix = 'set -euo pipefail;'
src/repl.ts
@@ -20,7 +20,7 @@ import chalk from 'chalk'
 import { ProcessOutput } from './core.js'
 
 export function startRepl() {
-  process.env.ZX_VERBOSE = 'false'
+  (global as any).ZX_VERBOSE = false
   const r = repl.start({
     prompt: chalk.greenBright.bold('❯ '),
     useGlobal: true,