fix permissions error, fix cwd path
This commit is contained in:
parent
368b99ecfa
commit
942735b726
3 changed files with 4 additions and 3 deletions
|
@ -30,7 +30,7 @@ func NewCommand(options CommandOptions) (*LinuxCommand, error) {
|
||||||
func (cmd *LinuxCommand) Run() error {
|
func (cmd *LinuxCommand) Run() error {
|
||||||
|
|
||||||
command := exec.Command(cmd.Options.Shell, "-c", cmd.Options.Command)
|
command := exec.Command(cmd.Options.Shell, "-c", cmd.Options.Command)
|
||||||
command.Path = cmd.Options.Cwd
|
command.Dir = cmd.Options.Cwd
|
||||||
command.Args = append(command.Args, cmd.Options.Args...)
|
command.Args = append(command.Args, cmd.Options.Args...)
|
||||||
|
|
||||||
// Loop through env to format and add them to the command.
|
// Loop through env to format and add them to the command.
|
||||||
|
|
|
@ -16,9 +16,10 @@ func (cmd *LinuxCommand) isCommandExecutable(command string) (bool, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := unix.Access(command, unix.X_OK); err != nil {
|
if err := unix.Access(command, unix.X_OK); err != nil {
|
||||||
if !errors.Is(err, unix.EACCES) {
|
if err == unix.EACCES {
|
||||||
return false, nil
|
return false, nil
|
||||||
} else {
|
} else {
|
||||||
|
fmt.Println(err)
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
main.go
2
main.go
|
@ -1,4 +1,4 @@
|
||||||
package shell
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
Loading…
Reference in a new issue