mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Fix python not being resolved correctly if not in path (#4864)
* Don't replace plugin exec path if python command. Don't clobber exec * Fix logging of python resolve errors
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/stashapp/stash/pkg/plugin/hook"
|
||||
"github.com/stashapp/stash/pkg/python"
|
||||
"github.com/stashapp/stash/pkg/utils"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
@@ -294,16 +295,18 @@ func (c Config) getConfigPath() string {
|
||||
}
|
||||
|
||||
func (c Config) getExecCommand(task *OperationConfig) []string {
|
||||
ret := c.Exec
|
||||
// #4859 - don't modify the original exec command
|
||||
ret := append([]string{}, c.Exec...)
|
||||
|
||||
if task != nil {
|
||||
ret = append(ret, task.ExecArgs...)
|
||||
}
|
||||
|
||||
if len(ret) > 0 {
|
||||
// #4859 - don't use the plugin path in the exec command if it is a python command
|
||||
if len(ret) > 0 && !python.IsPythonCommand(ret[0]) {
|
||||
_, err := exec.LookPath(ret[0])
|
||||
if err != nil {
|
||||
// change command to use absolute path
|
||||
// change command to run from the plugin path
|
||||
pluginPath := filepath.Dir(c.path)
|
||||
ret[0] = filepath.Join(pluginPath, ret[0])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user