Install installs the tool by executing its install_cmd through the shell.
(tool Tool, runner CommandRunner, stdout, stderr io.Writer)
| 64 | |
| 65 | // Install installs the tool by executing its install_cmd through the shell. |
| 66 | func Install(tool Tool, runner CommandRunner, stdout, stderr io.Writer) (int, error) { |
| 67 | if runner == nil { |
| 68 | runner = ShellRunner{} |
| 69 | } |
| 70 | if strings.TrimSpace(tool.InstallCmd) == "" { |
| 71 | return 0, ErrNoInstallCommand |
| 72 | } |
| 73 | name, args := shellCommand(tool.InstallCmd) |
| 74 | return runner.Run(name, args, stdout, stderr) |
| 75 | } |
| 76 | |
| 77 | // Uninstall best-effort removes the tool. npm-installed tools are removed via |
| 78 | // `npm uninstall -g <pkg>`; for other install styles we fall back to deleting |