Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid starting and stopping spinner loops #7131

Merged
merged 1 commit into from
Mar 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/utils/shell.ts
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import execa from 'execa'
// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'stri... Remove this comment to see the full error message
import stripAnsiCc from 'strip-ansi-control-characters'

import type { Spinner } from '../lib/spinner.js'
import { stopSpinner, type Spinner } from '../lib/spinner.js'
import { chalk, log, NETLIFYDEVERR, NETLIFYDEVWARN } from './command-helpers.js'
import { processOnExit } from './dev.js'

@@ -57,16 +57,19 @@ export const runCommand = (
cwd,
})

// This ensures that an active spinner stays at the bottom of the commandline
// Ensure that an active spinner stays at the bottom of the commandline
// even though the actual framework command might be outputting stuff
if (spinner?.isSpinning) {
// The spinner is initially "started" in the usual sense (rendering frames on an interval).
// In this case, we want to manually control when to clear and when to render a frame, so we turn this off.
stopSpinner({ error: false, spinner })
}
const pipeDataWithSpinner = (writeStream: NodeJS.WriteStream, chunk: any) => {
if (spinner?.isSpinning) {
spinner.clear()
}
writeStream.write(chunk, () => {
if (spinner?.isSpinning) {
spinner.start()
}
spinner?.spin()
})
}

Loading