remove deprecated ioutil
This commit is contained in:
parent
071ebba4ae
commit
50ff4ba0ac
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user