|
|
@ -133,12 +133,18 @@ func (d *daemonState) handleLaunch(msg *LaunchMsg, m *ipc.Message) error {
|
|
|
|
return m.Respond(&ErrorMsg{err.Error()})
|
|
|
|
return m.Respond(&ErrorMsg{err.Error()})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if sbox := d.getRunningSandboxByName(p.Name); sbox != nil {
|
|
|
|
if sbox := d.getRunningSandboxByName(p.Name); sbox != nil {
|
|
|
|
d.Info("Found running sandbox for `%s`, running program there", p.Name)
|
|
|
|
if msg.Noexec {
|
|
|
|
sbox.launchProgram(msg.Pwd, msg.Args, d.log)
|
|
|
|
errmsg := "Asked to launch program but sandbox is running and noexec is set!"
|
|
|
|
|
|
|
|
d.Notice(errmsg)
|
|
|
|
|
|
|
|
return m.Respond(&ErrorMsg{errmsg})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
d.Info("Found running sandbox for `%s`, running program there", p.Name)
|
|
|
|
|
|
|
|
sbox.launchProgram(msg.Pwd, msg.Args, d.log)
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
d.Debug("Would launch %s", p.Name)
|
|
|
|
d.Debug("Would launch %s", p.Name)
|
|
|
|
env := d.sanitizeEnvironment(p, msg.Env)
|
|
|
|
env := d.sanitizeEnvironment(p, msg.Env)
|
|
|
|
_, err = d.launch(p, msg.Pwd, msg.Args, env, m.Ucred.Uid, m.Ucred.Gid, d.log)
|
|
|
|
_, err = d.launch(p, msg.Pwd, msg.Args, env, msg.Noexec, m.Ucred.Uid, m.Ucred.Gid, d.log)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
d.Warning("Launch of %s failed: %v", p.Name, err)
|
|
|
|
d.Warning("Launch of %s failed: %v", p.Name, err)
|
|
|
|
return m.Respond(&ErrorMsg{err.Error()})
|
|
|
|
return m.Respond(&ErrorMsg{err.Error()})
|
|
|
|