| 147 | } |
| 148 | |
| 149 | func (plugin *Plugin) Run(ctx context.Context, args []string) { |
| 150 | if err := UpdatePath(); err != nil { |
| 151 | logrus.Warnf("failed to update PATH environment: %v", err) |
| 152 | // PATH update failure shouldn't prevent plugin execution |
| 153 | } |
| 154 | |
| 155 | cmd := exec.CommandContext(ctx, plugin.Path, args...) |
| 156 | cmd.Stdin = os.Stdin |
| 157 | cmd.Stdout = os.Stdout |
| 158 | cmd.Stderr = os.Stderr |
| 159 | cmd.Env = os.Environ() |
| 160 | |
| 161 | err := cmd.Run() |
| 162 | osutil.HandleExitError(err) |
| 163 | if err == nil { |
| 164 | os.Exit(0) //nolint:revive // it's intentional to call os.Exit in this function |
| 165 | } |
| 166 | logrus.Fatalf("external command %q failed: %v", plugin.Path, err) |
| 167 | } |
| 168 | |
| 169 | var descRegex = regexp.MustCompile(`<limactl-desc>(.*?)</limactl-desc>`) |
| 170 | |