mirror of
https://github.com/bettercap/bettercap
synced 2025-07-30 11:40:33 -07:00
fix: fixed vm locking
This commit is contained in:
parent
3c20f2c9aa
commit
2b1ff7d59f
3 changed files with 35 additions and 31 deletions
|
@ -56,9 +56,12 @@ func jsOnEventFunc(call otto.FunctionCall) otto.Value {
|
|||
|
||||
for event := range listener {
|
||||
if expr == "" || event.Tag == expr {
|
||||
// lock vm
|
||||
I.script.Lock()
|
||||
if _, err := cb.Call(otto.NullValue(), event); err != nil {
|
||||
I.Events.Log(log.ERROR, "error dispatching event %s: %v", event.Tag, err)
|
||||
}
|
||||
I.script.Unlock()
|
||||
}
|
||||
}
|
||||
}(filterExpr, cb)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue