Skip to content

Commit

Permalink
Merge pull request #409 from pterm/352-dont-stop-liveprinters-if-they…
Browse files Browse the repository at this point in the history
…-are-already-stopped
  • Loading branch information
MarvinJWendt committed Oct 3, 2022
2 parents d5e6ca6 + 4594983 commit ab30f0c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions area_printer.go
Expand Up @@ -97,6 +97,9 @@ func (p *AreaPrinter) Start(text ...interface{}) (*AreaPrinter, error) {
// Stop terminates the AreaPrinter immediately.
// The AreaPrinter will not resolve into anything.
func (p *AreaPrinter) Stop() error {
if !p.isActive {
return nil
}
p.isActive = false
if p.RemoveWhenDone {
p.Clear()
Expand Down
2 changes: 1 addition & 1 deletion progressbar_printer.go
Expand Up @@ -164,7 +164,7 @@ func (p *ProgressbarPrinter) Increment() *ProgressbarPrinter {
return p
}

// This method changed the title and re-renders the progressbar
// UpdateTitle updates the title and re-renders the progressbar
func (p *ProgressbarPrinter) UpdateTitle(title string) *ProgressbarPrinter {
p.Title = title
p.updateProgress()
Expand Down
3 changes: 3 additions & 0 deletions spinner_printer.go
Expand Up @@ -161,6 +161,9 @@ func (s SpinnerPrinter) Start(text ...interface{}) (*SpinnerPrinter, error) {
// Stop terminates the SpinnerPrinter immediately.
// The SpinnerPrinter will not resolve into anything.
func (s *SpinnerPrinter) Stop() error {
if !s.IsActive {
return nil
}
s.IsActive = false
if s.RemoveWhenDone {
fClearLine(s.Writer)
Expand Down

0 comments on commit ab30f0c

Please sign in to comment.