Skip to content

Instantly share code, notes, and snippets.

@thehajime
Created September 29, 2020 14:08
Show Gist options
  • Save thehajime/8a4780f2a3e58ad780da383fec95afd7 to your computer and use it in GitHub Desktop.
Save thehajime/8a4780f2a3e58ad780da383fec95afd7 to your computer and use it in GitHub Desktop.
diff --git a/runc.go b/runc.go
index 7281131..7f8d97f 100644
--- a/runc.go
+++ b/runc.go
@@ -32,7 +32,6 @@ import (
"time"
specs "github.com/opencontainers/runtime-spec/specs-go"
- "golang.org/x/sys/unix"
)
// Format is the type of log formatting options avaliable
@@ -55,21 +54,6 @@ const (
DefaultCommand = "runc"
)
-// Runc is the client to the runc cli
-type Runc struct {
- //If command is empty, DefaultCommand is used
- Command string
- Root string
- Debug bool
- Log string
- LogFormat Format
- PdeathSignal unix.Signal
- Setpgid bool
- Criu string
- SystemdCgroup bool
- Rootless *bool // nil stands for "auto"
-}
-
// List returns all containers created inside the provided runc root directory
func (r *Runc) List(context context.Context) ([]*Container, error) {
data, err := cmdOutput(r.command(context, "list", "--format=json"), false)
diff --git a/runc_unix.go b/runc_unix.go
new file mode 100644
index 0000000..8ba9ab7
--- /dev/null
+++ b/runc_unix.go
@@ -0,0 +1,39 @@
+//+build !windows
+
+/*
+ Copyright The containerd Authors.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package runc
+
+import (
+ "golang.org/x/sys/unix"
+)
+
+// Runc is the client to the runc cli
+type Runc struct {
+ //If command is empty, DefaultCommand is used
+ Command string
+ Root string
+ Debug bool
+ Log string
+ LogFormat Format
+ PdeathSignal unix.Signal
+ Setpgid bool
+ Criu string
+ SystemdCgroup bool
+ Rootless *bool // nil stands for "auto"
+}
+
diff --git a/runc_windows.go b/runc_windows.go
new file mode 100644
index 0000000..dd520c0
--- /dev/null
+++ b/runc_windows.go
@@ -0,0 +1,32 @@
+/*
+ Copyright The containerd Authors.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package runc
+
+// Runc is the client to the runc cli
+type Runc struct {
+ //If command is empty, DefaultCommand is used
+ Command string
+ Root string
+ Debug bool
+ Log string
+ LogFormat Format
+ Setpgid bool
+ Criu string
+ SystemdCgroup bool
+ Rootless *bool // nil stands for "auto"
+}
+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment