remove deprecated ioutil

This commit is contained in:
wh1te909 2023-05-22 13:16:51 -07:00
parent 071ebba4ae
commit 50ff4ba0ac
2 changed files with 2 additions and 4 deletions

View File

@ -16,7 +16,6 @@ import (
"context"
"errors"
"fmt"
"io/ioutil"
"math"
"os"
"os/exec"
@ -505,7 +504,7 @@ func (a *Agent) CleanupAgentUpdates() {
func (a *Agent) RunPythonCode(code string, timeout int, args []string) (string, error) {
content := []byte(code)
tmpfn, _ := ioutil.TempFile(a.WinTmpDir, "*.py")
tmpfn, _ := os.CreateTemp(a.WinTmpDir, "*.py")
if _, err := tmpfn.Write(content); err != nil {
a.Logger.Debugln(err)
return "", err

View File

@ -16,7 +16,6 @@ import (
"context"
"errors"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
@ -124,7 +123,7 @@ func (a *Agent) RunScript(code string, shell string, args []string, timeout int,
tmpDir = a.WinRunAsUserTmpDir
}
tmpfn, err := ioutil.TempFile(tmpDir, ext)
tmpfn, err := os.CreateTemp(tmpDir, ext)
if err != nil {
a.Logger.Errorln(err)
return "", err.Error(), 85, err