remove deprecated ioutil
This commit is contained in:
parent
071ebba4ae
commit
50ff4ba0ac
@ -16,7 +16,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@ -505,7 +504,7 @@ func (a *Agent) CleanupAgentUpdates() {
|
|||||||
|
|
||||||
func (a *Agent) RunPythonCode(code string, timeout int, args []string) (string, error) {
|
func (a *Agent) RunPythonCode(code string, timeout int, args []string) (string, error) {
|
||||||
content := []byte(code)
|
content := []byte(code)
|
||||||
tmpfn, _ := ioutil.TempFile(a.WinTmpDir, "*.py")
|
tmpfn, _ := os.CreateTemp(a.WinTmpDir, "*.py")
|
||||||
if _, err := tmpfn.Write(content); err != nil {
|
if _, err := tmpfn.Write(content); err != nil {
|
||||||
a.Logger.Debugln(err)
|
a.Logger.Debugln(err)
|
||||||
return "", err
|
return "", err
|
||||||
|
@ -16,7 +16,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -124,7 +123,7 @@ func (a *Agent) RunScript(code string, shell string, args []string, timeout int,
|
|||||||
tmpDir = a.WinRunAsUserTmpDir
|
tmpDir = a.WinRunAsUserTmpDir
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpfn, err := ioutil.TempFile(tmpDir, ext)
|
tmpfn, err := os.CreateTemp(tmpDir, ext)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
a.Logger.Errorln(err)
|
a.Logger.Errorln(err)
|
||||||
return "", err.Error(), 85, err
|
return "", err.Error(), 85, err
|
||||||
|
Loading…
Reference in New Issue
Block a user