From cf33a53ba031dcc83580de1b92436701a4faa405 Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Fri, 13 May 2022 12:19:46 +0100 Subject: [PATCH] Remove ioutil. --- internal/zenutil/run_darwin.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/zenutil/run_darwin.go b/internal/zenutil/run_darwin.go index a4fead0..4d68525 100644 --- a/internal/zenutil/run_darwin.go +++ b/internal/zenutil/run_darwin.go @@ -3,7 +3,6 @@ package zenutil import ( "bytes" "context" - "io/ioutil" "os" "os/exec" "path/filepath" @@ -21,12 +20,12 @@ func Run(ctx context.Context, script string, data interface{}) ([]byte, error) { if Command { // Try to use syscall.Exec, fallback to exec.Command. if path, err := exec.LookPath("osascript"); err != nil { - } else if t, err := ioutil.TempFile("", ""); err != nil { + } else if t, err := os.CreateTemp("", ""); err != nil { } else if err := os.Remove(t.Name()); err != nil { } else if _, err := t.Write(buf.Bytes()); err != nil { } else if _, err := t.Seek(0, 0); err != nil { - } else if err := syscall.Dup2(int(t.Fd()), syscall.Stdin); err != nil { } else if err := os.Stderr.Close(); err != nil { + } else if err := syscall.Dup2(int(t.Fd()), syscall.Stdin); err != nil { } else { syscall.Exec(path, []string{"osascript", "-l", "JavaScript"}, nil) } @@ -54,7 +53,7 @@ func RunProgress(ctx context.Context, max int, data Progress) (dlg *progressDial return nil, err } - t, err := ioutil.TempDir("", "") + t, err := os.MkdirTemp("", "") if err != nil { return nil, err }