bugfix: orbit linux zenity progress windows (#24280)
This commit is contained in:
@@ -79,6 +79,35 @@ func runWithOutput(path string, opts eopts) (output []byte, exitCode int, err er
|
||||
return output, exitCode, nil
|
||||
}
|
||||
|
||||
func runWithStdin(path string, opts eopts) (io.WriteCloser, error) {
|
||||
args, err := getUserAndDisplayArgs(path, opts)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("get args: %w", err)
|
||||
}
|
||||
|
||||
args = append(args, path)
|
||||
|
||||
if len(opts.args) > 0 {
|
||||
for _, arg := range opts.args {
|
||||
args = append(args, arg[0], arg[1])
|
||||
}
|
||||
}
|
||||
|
||||
cmd := exec.Command("sudo", args...)
|
||||
log.Printf("cmd=%s", cmd.String())
|
||||
|
||||
stdin, err := cmd.StdinPipe()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("stdin pipe: %w", err)
|
||||
}
|
||||
|
||||
if err := cmd.Start(); err != nil {
|
||||
return nil, fmt.Errorf("open path %q: %w", path, err)
|
||||
}
|
||||
|
||||
return stdin, nil
|
||||
}
|
||||
|
||||
func getUserAndDisplayArgs(path string, opts eopts) ([]string, error) {
|
||||
user, err := getLoginUID()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user