diff options
| author | Shulhan <ms@kilabit.info> | 2023-12-22 00:18:24 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-12-22 00:18:56 +0700 |
| commit | 66a18a789edaa35dfa4446846eeeffabfee0b269 (patch) | |
| tree | 97fe49378e4e77e5e83138c5cf696a9d2c9152a5 /exec_request.go | |
| parent | 1ba33791ffb7be31358ed776448ee86b4438dad3 (diff) | |
| download | awwan-66a18a789edaa35dfa4446846eeeffabfee0b269.tar.xz | |
all: check script file is a directory
This changes we make sure that the passed script path is not a directory
to prevent error when running play with unknown host name.
Diffstat (limited to 'exec_request.go')
| -rw-r--r-- | exec_request.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/exec_request.go b/exec_request.go index 8d78d3d..16ce595 100644 --- a/exec_request.go +++ b/exec_request.go @@ -97,6 +97,15 @@ func (req *ExecRequest) init(workDir string) (err error) { return err } + var fi os.FileInfo + fi, err = os.Stat(req.scriptPath) + if err != nil { + return err + } + if fi.Mode().IsDir() { + return fmt.Errorf(`%q is a directory`, req.Script) + } + req.lineRange = parseLineRange(req.LineRange) // Create log file to record all input and output for audit in the |
