Skip to content

Commit

Permalink
interrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
houdini91 committed May 1, 2023
1 parent 3789792 commit f650933
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/syft/cli/eventloop/event_loop.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func EventLoop(workerErrs <-chan error, signals <-chan os.Signal, subscription *
// TODO: should we unsubscribe? should we try to halt execution? or continue?
}
}
case <-signals:
case e, _ := <-signals:
// ignore further results from any event source and exit ASAP, but ensure that all cache is cleaned up.
// we ignore further errors since cleaning up the tmp directories will affect running catalogers that are
// reading/writing from/to their nested temp dirs. This is acceptable since we are bailing without result.
Expand All @@ -71,6 +71,7 @@ func EventLoop(workerErrs <-chan error, signals <-chan os.Signal, subscription *
events = nil
workerErrs = nil
forceTeardown = true
retErr = multierror.Append(retErr, fmt.Errorf("%s", e))
}
}

Expand Down
5 changes: 5 additions & 0 deletions internal/ui/lib_ui.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package ui

import (
"fmt"

syftEvent "github.com/anchore/syft/syft/event"
"github.com/wagoodman/go-partybus"
)
Expand Down Expand Up @@ -30,5 +32,8 @@ func (h *libUI) Handle(event partybus.Event) error {
}

func (h *libUI) Teardown(force bool) error {
if force {
return fmt.Errorf("teardown")
}
return nil
}

0 comments on commit f650933

Please sign in to comment.