-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #271 from depot/exec
Add engine detection to `exec`
- Loading branch information
Showing
5 changed files
with
809 additions
and
499 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package helpers | ||
|
||
import ( | ||
"fmt" | ||
"os/exec" | ||
"strings" | ||
) | ||
|
||
func ResolveDaggerVersion() (string, error) { | ||
daggerPath, err := exec.LookPath("dagger") | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
output, err := exec.Command(daggerPath, "version").Output() | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
parsed := strings.Split(string(output), " ") | ||
if len(parsed) < 2 { | ||
return "", fmt.Errorf("unable able to parse dagger version") | ||
} | ||
return parsed[1], nil | ||
} |
Oops, something went wrong.