Replace deprecated method calls
This commit is contained in:
parent
8e0a9fe9e7
commit
b8b5dd1bcd
21
unseal.go
21
unseal.go
@ -6,17 +6,18 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var help bool
|
||||
var cmd string
|
||||
var group string
|
||||
var execargs []string
|
||||
var (
|
||||
help bool
|
||||
cmd string
|
||||
group string
|
||||
execargs []string
|
||||
)
|
||||
|
||||
var secretsFile string
|
||||
|
||||
@ -63,12 +64,12 @@ func system(command string, pipe bool, args ...string) (string, string, error) {
|
||||
}
|
||||
|
||||
if !pipe {
|
||||
stdout, err = ioutil.ReadAll(stdoutPipe)
|
||||
stdout, err = io.ReadAll(stdoutPipe)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
|
||||
stderr, err = ioutil.ReadAll(stderrPipe)
|
||||
stderr, err = io.ReadAll(stderrPipe)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
@ -202,7 +203,7 @@ func wrap() {
|
||||
|
||||
insertEnvironment(parseEnvironment(decrypt()))
|
||||
|
||||
_, _, err := system(execargs[0], true, execargs[1:len(execargs)]...)
|
||||
_, _, err := system(execargs[0], true, execargs[1:]...)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "Error executing external command: ", err)
|
||||
}
|
||||
@ -244,12 +245,12 @@ func editFile(file string) error {
|
||||
func copyFile(oldpath, newpath string) error {
|
||||
err := os.Rename(oldpath, newpath)
|
||||
if err != nil {
|
||||
byteArr, err2 := ioutil.ReadFile(oldpath)
|
||||
byteArr, err2 := os.ReadFile(oldpath)
|
||||
if err2 != nil {
|
||||
return err2
|
||||
}
|
||||
|
||||
err2 = ioutil.WriteFile(newpath, byteArr, mode)
|
||||
err2 = os.WriteFile(newpath, byteArr, mode)
|
||||
if err2 == nil {
|
||||
_ = os.Remove(oldpath)
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user