mirror of
https://github.com/appleboy/drone-ssh.git
synced 2025-07-05 22:02:49 +08:00
fix: improve script file handling and testing robustness
- Add a check to verify if the script file exists before reading it Signed-off-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
parent
d56db7a5b3
commit
2c52afb7fd
4
main.go
4
main.go
@ -277,6 +277,10 @@ func run(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if f := c.String("script.file"); f != "" {
|
if f := c.String("script.file"); f != "" {
|
||||||
|
// check file exists
|
||||||
|
if _, err := os.Stat(f); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
s, err := os.ReadFile(f)
|
s, err := os.ReadFile(f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user