@@ -42,6 +42,7 @@ import {
4242 getSocketCliBootstrapSpec ,
4343} from '@socketsecurity/lib/env/socket-cli'
4444import { getDefaultLogger } from '@socketsecurity/lib/logger'
45+ import { getDefaultSpinner } from '@socketsecurity/lib/spinner'
4546
4647import { rootAliases , rootCommands } from './commands.mts'
4748import { SOCKET_CLI_BIN_NAME } from './constants/packages.mts'
@@ -174,6 +175,12 @@ void (async () => {
174175 } catch ( e ) {
175176 process . exitCode = 1
176177
178+ // Stop any active spinner before emitting error output, otherwise
179+ // its animation clashes with the error text on the same line.
180+ // Spinner-wrapped command paths stop their own on catch, but any
181+ // exception that bypasses those handlers reaches us here.
182+ getDefaultSpinner ( ) ?. stop ( )
183+
177184 // Track CLI error for telemetry.
178185 await trackCliError ( process . argv , cliStartTime , e , process . exitCode )
179186 debug ( 'CLI uncaught error' )
@@ -195,8 +202,6 @@ void (async () => {
195202 if ( isJson ) {
196203 logger . log ( serializeResultJson ( formatErrorForJson ( e ) ) )
197204 } else {
198- // Add 2 newlines in stderr to bump below any spinner.
199- logger . error ( '\n' )
200205 logger . error ( formatErrorForTerminal ( e ) )
201206 debugDirNs ( 'inspect' , { error : e } )
202207 }
0 commit comments