summaryrefslogtreecommitdiffstats
path: root/client/go/util/io.go
diff options
context:
space:
mode:
Diffstat (limited to 'client/go/util/io.go')
-rw-r--r--client/go/util/io.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/client/go/util/io.go b/client/go/util/io.go
index 6aab64b8827..50122324fae 100644
--- a/client/go/util/io.go
+++ b/client/go/util/io.go
@@ -32,6 +32,15 @@ func IsRegularFile(path string) bool {
return !errors.Is(err, os.ErrNotExist) && info != nil && info.Mode().IsRegular()
}
+// Returns true if the given path points to an executable
+func IsExecutableFile(path string) bool {
+ info, err := os.Stat(path)
+ return !errors.Is(err, os.ErrNotExist) &&
+ info != nil &&
+ info.Mode().IsRegular() &&
+ ((info.Mode() & 0111) == 0111)
+}
+
// Returns the content of a reader as a string
func ReaderToString(reader io.Reader) string {
var buffer strings.Builder