Fix: Issue with copying
This commit is contained in:
parent
0170b7cd90
commit
b618f7348c
3 changed files with 70 additions and 5 deletions
|
@ -133,8 +133,14 @@ func ExecAndLogSudo(isRoot, noisy bool, cmd string) error {
|
|||
fmt.Printf("Executing (elevated): %s\nSee debug.log for detailed output\n", cmd)
|
||||
}
|
||||
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cs := strings.Fields(cmd)
|
||||
r := exec.Command(cs[0], cs[1:]...)
|
||||
r.Dir = wd
|
||||
|
||||
cmdCombinedOut, err := r.CombinedOutput()
|
||||
outStr := string(cmdCombinedOut)
|
||||
|
@ -148,5 +154,9 @@ func ExecAndLogSudo(isRoot, noisy bool, cmd string) error {
|
|||
fmt.Printf("%s\n", outStr)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
err = fmt.Errorf("failed to execute %s: %w\n%s", cmd, err, outStr)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue