Files
skillshare/cmd
Willie 18cd0ecc94 fix(cli): preserve non-zero exit code for --json error paths
writeJSONError now returns a jsonSilentError sentinel that main()
recognises — it exits with code 1 without printing plain-text output
to stdout. This fixes a regression where --json errors (config load
failure, missing source dir, discovery failure) returned exit 0.

All writeJSONError call sites changed from the broken pattern:
  writeJSONError(err); return nil   // exit 0, wrong
to:
  return writeJSONError(err)        // exit 1, correct

Also applied the same fix to update.go error paths which had the
older pattern of writeJSONError(err) followed by return err (which
would print both JSON and plain text).

Added regression tests for sync and install error paths verifying
both non-zero exit code and valid JSON error output on stdout.
2026-03-06 02:15:36 +08:00
..