@gmickel/gno 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/cli/run.ts CHANGED
@@ -169,7 +169,10 @@ Run '${CLI_NAME} --help' for full command list.
169
169
  * No process.exit() - caller sets process.exitCode.
170
170
  */
171
171
  export async function runCli(argv: string[]): Promise<number> {
172
- // Reset global state for clean invocation (important for testing)
172
+ // Reset global state for clean invocation (important for testing).
173
+ // The detach paths (runServeDetach / runDaemonDetach) read argv from
174
+ // Commander's per-invocation `Command.rawArgs` via `resolveCliArgv()`,
175
+ // so no separate process-global capture is needed here.
173
176
  resetGlobals();
174
177
 
175
178
  const isJson = argvWantsJson(argv);
@@ -204,8 +207,13 @@ export async function runCli(argv: string[]): Promise<number> {
204
207
  } catch (err) {
205
208
  // Handle CliError with proper JSON formatting
206
209
  if (err instanceof CliError) {
207
- const output = formatErrorForOutput(err, { json: isJson });
208
- process.stderr.write(`${output}\n`);
210
+ // `silent` is reserved for codes whose exit value carries the meaning
211
+ // (e.g. NOT_RUNNING from `--stop` per spec/cli.md). Skip stderr but
212
+ // still propagate the code.
213
+ if (!err.silent) {
214
+ const output = formatErrorForOutput(err, { json: isJson });
215
+ process.stderr.write(`${output}\n`);
216
+ }
209
217
  return exitCodeFor(err);
210
218
  }
211
219