Skip to content

Commit

Permalink
chore: typos fix
Browse files Browse the repository at this point in the history
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
  • Loading branch information
rustatian committed Dec 8, 2023
1 parent 5b4c234 commit bff2011
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions init.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ func (b *command) Write(data []byte) (int, error) {

// create command for the process
func (b *command) createProcess(env map[string]string, cmd []string) *exec.Cmd {
// cmdArgs contain command arguments if the command in form of: php <command> or ls <command> -i -b
// cmdArgs contain command arguments if the command in the form of: php <command> or ls <command> -i -b
var cmdArgs []string
var command *exec.Cmd
var execCmd *exec.Cmd

// here we may have 2 cases: command declared as a space separated string or as a slice
switch len(cmd) {
Expand All @@ -86,23 +86,23 @@ func (b *command) createProcess(env map[string]string, cmd []string) *exec.Cmd {
}

if len(cmdArgs) == 1 {
command = exec.Command(cmd[0])
execCmd = exec.Command(cmd[0])
} else {
command = exec.Command(cmdArgs[0], cmdArgs[1:]...)
execCmd = exec.Command(cmdArgs[0], cmdArgs[1:]...)
}

// set env variables from the config
if len(env) > 0 {
for k, v := range env {
command.Env = append(command.Env, fmt.Sprintf("%s=%s", strings.ToUpper(k), os.Expand(v, os.Getenv)))
execCmd.Env = append(execCmd.Env, fmt.Sprintf("%s=%s", strings.ToUpper(k), os.Expand(v, os.Getenv)))
}
}

// append system envs
command.Env = append(command.Env, os.Environ()...)
execCmd.Env = append(execCmd.Env, os.Environ()...)
// redirect stderr and stdout into the Write function of the process.go
command.Stderr = b
command.Stdout = b
execCmd.Stderr = b
execCmd.Stdout = b

return command
return execCmd
}
4 changes: 2 additions & 2 deletions plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const (
type Configurer interface {
// UnmarshalKey takes a single key and unmarshal it into a Struct.
UnmarshalKey(name string, out any) error
// Has checks if config section exists.
// Has checks if a config section exists.
Has(name string) bool
// RRVersion is the roadrunner current version
RRVersion() string
Expand Down Expand Up @@ -315,7 +315,7 @@ func (p *Plugin) customCmd(env map[string]string) func(command []string) *exec.C
}

utils.IsolateProcess(cmd)
// if user is not empty, and OS is linux or macos
// if a user is not empty, and OS is linux or macOS
// execute php worker from that particular user
if p.cfg.User != "" {
err := utils.ExecuteFromUser(cmd, p.cfg.User)
Expand Down

0 comments on commit bff2011

Please sign in to comment.