Skip to content

Commit

Permalink
more error info
Browse files Browse the repository at this point in the history
  • Loading branch information
cheng-zhongliang committed Aug 13, 2023
1 parent dbaf213 commit 8c35229
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions signal.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,17 @@ func (sp *signaler) subscribe(sig int) error {
}

func (sp *signaler) unsubscribe(sig int) error {
var (
i int
s os.Signal
)
notExists := true

for i, s = range sp.signals {
for i, s := range sp.signals {
if s == syscall.Signal(sig) {
notExists = false
sp.signals = append(sp.signals[:i], sp.signals[i+1:]...)
break
}
}

if i == len(sp.signals)-1 {
if notExists {
return ErrEventNotExists
}

Expand Down

0 comments on commit 8c35229

Please sign in to comment.