diff options
author | Valery Piashchynski <[email protected]> | 2020-11-19 17:28:30 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-11-19 17:28:30 +0300 |
commit | 71c81a91f9f967e41310077bd26b1dedb0b49556 (patch) | |
tree | cce9cb740bae0b9acbfc15d76823174f571a0a6c /plugins/server | |
parent | e9595a5c133ff02b765c0b59913593e7f91bc4e7 (diff) |
huge linters fix update
Diffstat (limited to 'plugins/server')
-rw-r--r-- | plugins/server/plugin.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/server/plugin.go b/plugins/server/plugin.go index 4d606390..a655a8d2 100644 --- a/plugins/server/plugin.go +++ b/plugins/server/plugin.go @@ -62,11 +62,17 @@ func (server *Plugin) Stop() error { // CmdFactory provides worker command factory assocated with given context. func (server *Plugin) CmdFactory(env server.Env) (func() *exec.Cmd, error) { + const op = errors.Op("cmd factory") var cmdArgs []string // create command according to the config cmdArgs = append(cmdArgs, strings.Split(server.cfg.Command, " ")...) - + if len(cmdArgs) < 2 { + return nil, errors.E(op, errors.Str("should be in form of `php <script>")) + } + if cmdArgs[0] != "php" { + return nil, errors.E(op, errors.Str("first arg in command should be `php`")) + } return func() *exec.Cmd { cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...) util.IsolateProcess(cmd) |