MCPcopy Index your code
hub / github.com/smallstep/cli / Run

Function Run

internal/plugin/plugin.go:56–72  ·  view source on GitHub ↗

Run starts the given command with the arguments in the context and waits for it to complete.

(ctx *cli.Context, file string)

Source from the content-addressed store, hash-verified

54// Run starts the given command with the arguments in the context and waits for
55// it to complete.
56func Run(ctx *cli.Context, file string) error {
57 args := ctx.Args()
58 cmdName := file
59
60 // if running on Windows and (likely) a PowerShell script, invoke powershell
61 // with the arguments instead of the plugin file directly.
62 if runtime.GOOS == "windows" && strings.ToLower(filepath.Ext(file)) == ".ps1" {
63 cmdName = "powershell"
64 args = append([]string{args[0], "-noprofile", "-nologo", file}, args[1:]...)
65 }
66
67 cmd := exec.Command(cmdName, args[1:]...)
68 cmd.Stdin = os.Stdin
69 cmd.Stdout = os.Stdout
70 cmd.Stderr = os.Stderr
71 return cmd.Run()
72}
73
74// GetURL returns the project or the download URL of a well-known plugin.
75func GetURL(name string) string {

Callers 1

newAppFunction · 0.92

Calls 1

RunMethod · 0.65

Tested by

no test coverage detected