nixpkgs/pkgs/development/tools/summon/resolve-paths.patch
2020-06-29 18:39:15 +03:00

40 lines
845 B
Diff

From dd34727ebfbd59738084eeb7c2a020e40a4d0abe Mon Sep 17 00:00:00 2001
From: Quentin <Quentin Inkling>
Date: Mon, 29 Jun 2020 17:35:04 +0300
Subject: [PATCH] Patch for
---
provider/provider.go | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/provider/provider.go b/provider/provider.go
index c1e28d9..f20fdaa 100644
--- a/provider/provider.go
+++ b/provider/provider.go
@@ -78,7 +78,22 @@ func expandPath(provider string) string {
if path.Base(provider) != provider {
return provider
}
+
+ var (
+ stdOut bytes.Buffer
+ stdErr bytes.Buffer
+ )
+ cmd := exec.Command("which", provider)
+ cmd.Stdout = &stdOut
+ cmd.Stderr = &stdErr
+ err := cmd.Run()
+
+ if err == nil {
+ return strings.TrimSpace(stdOut.String())
+ }
+
return path.Join(DefaultPath, provider)
+
}
func getDefaultPath() string {
--
2.27.0