diff options
author | Ayush Ranjan <ayushranjan@google.com> | 2021-03-06 22:04:58 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-03-06 22:07:07 -0800 |
commit | e668288fafe378ab4dc7fbb23ac933a15a2fff94 (patch) | |
tree | 4b75b894e723f7fc9014e50e2b66e5b2c0bb75a8 /runsc/cli | |
parent | 0a909ba75a556db6acbb2a30d2e741b365217c83 (diff) |
[op] Replace syscall package usage with golang.org/x/sys/unix in runsc/.
The syscall package has been deprecated in favor of golang.org/x/sys.
Note that syscall is still used in some places because the following don't seem
to have an equivalent in unix package:
- syscall.SysProcIDMap
- syscall.Credential
Updates #214
PiperOrigin-RevId: 361381490
Diffstat (limited to 'runsc/cli')
-rw-r--r-- | runsc/cli/BUILD | 1 | ||||
-rw-r--r-- | runsc/cli/main.go | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/runsc/cli/BUILD b/runsc/cli/BUILD index 32cce2a18..f1e3cce68 100644 --- a/runsc/cli/BUILD +++ b/runsc/cli/BUILD @@ -18,5 +18,6 @@ go_library( "//runsc/flag", "//runsc/specutils", "@com_github_google_subcommands//:go_default_library", + "@org_golang_x_sys//unix:go_default_library", ], ) diff --git a/runsc/cli/main.go b/runsc/cli/main.go index bf6928941..a3c515f4b 100644 --- a/runsc/cli/main.go +++ b/runsc/cli/main.go @@ -23,10 +23,10 @@ import ( "os" "os/signal" "runtime" - "syscall" "time" "github.com/google/subcommands" + "golang.org/x/sys/unix" "gvisor.dev/gvisor/pkg/log" "gvisor.dev/gvisor/pkg/refs" "gvisor.dev/gvisor/pkg/sentry/platform" @@ -198,7 +198,7 @@ func Main(version string) { // want with them. Since Docker and Containerd both eat boot's stderr, we // dup our stderr to the provided log FD so that panics will appear in the // logs, rather than just disappear. - if err := syscall.Dup3(fd, int(os.Stderr.Fd()), 0); err != nil { + if err := unix.Dup3(fd, int(os.Stderr.Fd()), 0); err != nil { cmd.Fatalf("error dup'ing fd %d to stderr: %v", fd, err) } } else if conf.AlsoLogToStderr { @@ -227,11 +227,11 @@ func Main(version string) { // SIGTERM is sent to all processes if a test exceeds its // timeout and this case is handled by syscall_test_runner. log.Warningf("Block the TERM signal. This is only safe in tests!") - signal.Ignore(syscall.SIGTERM) + signal.Ignore(unix.SIGTERM) } // Call the subcommand and pass in the configuration. - var ws syscall.WaitStatus + var ws unix.WaitStatus subcmdCode := subcommands.Execute(context.Background(), conf, &ws) if subcmdCode == subcommands.ExitSuccess { log.Infof("Exiting with status: %v", ws) |