EnsureHelperToolPresent checks if helper tool exists and extracts it if not. On Mac OS, it also checks and set the file's owner to root:wheel and the setuid bit, it will request user to input password through a dialog to gain the rights to do so. path: absolute or relative path of the file to be che
(path string, prompt string, iconFullPath string)
| 28 | // prompt: the message to be shown on the dialog. |
| 29 | // iconPath: the full path of the icon to be shown on the dialog. |
| 30 | func EnsureHelperToolPresent(path string, prompt string, iconFullPath string) (err error) { |
| 31 | mu.Lock() |
| 32 | defer mu.Unlock() |
| 33 | if len(sysproxy) == 0 { |
| 34 | return fmt.Errorf("unable to find binary: %v", sysproxy) |
| 35 | } |
| 36 | be, err = byteexec.New(sysproxy, path) |
| 37 | if err != nil { |
| 38 | return fmt.Errorf("unable to extract helper tool: %v", err) |
| 39 | } |
| 40 | return ensureElevatedOnDarwin(be, prompt, iconFullPath) |
| 41 | } |
| 42 | |
| 43 | // On tells OS to configure proxy through `addr` as host:port. It always returns |
| 44 | // a function that can be used to clear the system proxy setting. If the current |
searching dependent graphs…