mirror of
https://github.com/bettercap/bettercap
synced 2025-08-21 05:53:20 -07:00
fix: reporting module name when it's already running or already stopped
This commit is contained in:
parent
fbcaf2989f
commit
40ec724ca6
20 changed files with 30 additions and 24 deletions
|
@ -230,9 +230,9 @@ func (m *SessionModule) Running() bool {
|
|||
func (m *SessionModule) SetRunning(running bool, cb func()) error {
|
||||
if running == m.Running() {
|
||||
if m.Started {
|
||||
return ErrAlreadyStarted
|
||||
return ErrAlreadyStarted(m.Name)
|
||||
} else {
|
||||
return ErrAlreadyStopped
|
||||
return ErrAlreadyStopped(m.Name)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,14 +35,20 @@ const (
|
|||
var (
|
||||
I = (*Session)(nil)
|
||||
|
||||
ErrAlreadyStarted = errors.New("module is already running")
|
||||
ErrAlreadyStopped = errors.New("module is not running")
|
||||
ErrNotSupported = errors.New("this component is not supported on this OS")
|
||||
ErrNotSupported = errors.New("this component is not supported on this OS")
|
||||
|
||||
reCmdSpaceCleaner = regexp.MustCompile(`^([^\s]+)\s+(.+)$`)
|
||||
reEnvVarCapture = regexp.MustCompile(`{env\.([^}]+)}`)
|
||||
)
|
||||
|
||||
func ErrAlreadyStarted(name string) error {
|
||||
return fmt.Errorf("module %s is already running", name)
|
||||
}
|
||||
|
||||
func ErrAlreadyStopped(name string) error {
|
||||
return fmt.Errorf("module %s is not running", name)
|
||||
}
|
||||
|
||||
type UnknownCommandCallback func(cmd string) bool
|
||||
|
||||
type GPS struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue