mirror of https://github.com/Hilbis/Hilbish
fix: deadlock in lua job add function and not taking proper amount of args
parent
b5c78a39a8
commit
9f6a07c90a
7
job.go
7
job.go
|
@ -179,7 +179,7 @@ func (j *jobHandler) loader(rtm *rt.Runtime) *rt.Table {
|
||||||
jobFuncs := map[string]util.LuaExport{
|
jobFuncs := map[string]util.LuaExport{
|
||||||
"all": {j.luaAllJobs, 0, false},
|
"all": {j.luaAllJobs, 0, false},
|
||||||
"get": {j.luaGetJob, 1, false},
|
"get": {j.luaGetJob, 1, false},
|
||||||
"add": {j.luaAddJob, 1, false},
|
"add": {j.luaAddJob, 2, false},
|
||||||
}
|
}
|
||||||
|
|
||||||
luaJob := rt.NewTable()
|
luaJob := rt.NewTable()
|
||||||
|
@ -209,10 +209,7 @@ func (j *jobHandler) luaGetJob(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *jobHandler) luaAddJob(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
func (j *jobHandler) luaAddJob(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
||||||
j.mu.RLock()
|
if err := c.CheckNArgs(2); err != nil {
|
||||||
defer j.mu.RUnlock()
|
|
||||||
|
|
||||||
if err := c.Check1Arg(); err != nil {
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
cmd, err := c.StringArg(0)
|
cmd, err := c.StringArg(0)
|
||||||
|
|
Loading…
Reference in New Issue