From 7e2759410f1349c88b7868b398acf1dcdaf22f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=97=E3=81=9A=E3=81=88?= <66309775+kuredoro@users.noreply.github.com> Date: Sat, 16 Oct 2021 20:03:35 +0300 Subject: [PATCH] Provided via cli executable is checked for being a directory. --- cmd/cptest/main.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/cptest/main.go b/cmd/cptest/main.go index 0028268..264e790 100644 --- a/cmd/cptest/main.go +++ b/cmd/cptest/main.go @@ -163,6 +163,17 @@ func main() { return } + execStat, err := os.Stat(execPath) + if err != nil { + fmt.Printf("error: read executable's properties: %v\n", err) + return + } + + if execStat.IsDir() { + fmt.Printf("error: provided executable %s is a directory\n", args.Executable) + return + } + proc := &Executable{ Path: execPath, Args: args.Args,