| @@ -252,14 +252,6 @@ func NewBinaryIO(ctx context.Context, id string, uri *url.URL) (_ runc.IO, err e | |||||||
| 		return nil, err | 		return nil, err | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	var args []string |  | ||||||
| 	for k, vs := range uri.Query() { |  | ||||||
| 		args = append(args, k) |  | ||||||
| 		if len(vs) > 0 { |  | ||||||
| 			args = append(args, vs[0]) |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	var closers []func() error | 	var closers []func() error | ||||||
| 	defer func() { | 	defer func() { | ||||||
| 		if err == nil { | 		if err == nil { | ||||||
| @@ -290,12 +282,7 @@ func NewBinaryIO(ctx context.Context, id string, uri *url.URL) (_ runc.IO, err e | |||||||
| 	} | 	} | ||||||
| 	closers = append(closers, r.Close, w.Close) | 	closers = append(closers, r.Close, w.Close) | ||||||
|  |  | ||||||
| 	cmd := exec.Command(uri.Path, args...) | 	cmd := NewBinaryCmd(uri, id, ns) | ||||||
| 	cmd.Env = append(cmd.Env, |  | ||||||
| 		"CONTAINER_ID="+id, |  | ||||||
| 		"CONTAINER_NAMESPACE="+ns, |  | ||||||
| 	) |  | ||||||
|  |  | ||||||
| 	cmd.ExtraFiles = append(cmd.ExtraFiles, out.r, serr.r, w) | 	cmd.ExtraFiles = append(cmd.ExtraFiles, out.r, serr.r, w) | ||||||
| 	// don't need to register this with the reaper or wait when | 	// don't need to register this with the reaper or wait when | ||||||
| 	// running inside a shim | 	// running inside a shim | ||||||
|   | |||||||
| @@ -14,7 +14,7 @@ | |||||||
|    limitations under the License. |    limitations under the License. | ||||||
| */ | */ | ||||||
| 
 | 
 | ||||||
| package runtime | package process | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"net/url" | 	"net/url" | ||||||
| @@ -26,7 +26,7 @@ import ( | |||||||
|  |  | ||||||
| 	"github.com/containerd/console" | 	"github.com/containerd/console" | ||||||
| 	"github.com/containerd/containerd/namespaces" | 	"github.com/containerd/containerd/namespaces" | ||||||
| 	"github.com/containerd/containerd/runtime" | 	"github.com/containerd/containerd/pkg/process" | ||||||
| 	"github.com/containerd/fifo" | 	"github.com/containerd/fifo" | ||||||
| 	"github.com/pkg/errors" | 	"github.com/pkg/errors" | ||||||
| ) | ) | ||||||
| @@ -75,14 +75,14 @@ func (p *linuxPlatform) CopyConsole(ctx context.Context, console console.Console | |||||||
| 			return nil, err | 			return nil, err | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		cmd := runtime.NewBinaryCmd(uri, id, ns) | 		cmd := process.NewBinaryCmd(uri, id, ns) | ||||||
|  |  | ||||||
| 		// In case of unexpected errors during logging binary start, close open pipes | 		// In case of unexpected errors during logging binary start, close open pipes | ||||||
| 		var filesToClose []*os.File | 		var filesToClose []*os.File | ||||||
|  |  | ||||||
| 		defer func() { | 		defer func() { | ||||||
| 			if retErr != nil { | 			if retErr != nil { | ||||||
| 				runtime.CloseFiles(filesToClose...) | 				process.CloseFiles(filesToClose...) | ||||||
| 			} | 			} | ||||||
| 		}() | 		}() | ||||||
|  |  | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ import ( | |||||||
|  |  | ||||||
| 	"github.com/containerd/console" | 	"github.com/containerd/console" | ||||||
| 	"github.com/containerd/containerd/namespaces" | 	"github.com/containerd/containerd/namespaces" | ||||||
| 	"github.com/containerd/containerd/runtime" | 	"github.com/containerd/containerd/pkg/process" | ||||||
| 	"github.com/containerd/fifo" | 	"github.com/containerd/fifo" | ||||||
| 	"github.com/pkg/errors" | 	"github.com/pkg/errors" | ||||||
| ) | ) | ||||||
| @@ -63,15 +63,14 @@ func (p *unixPlatform) CopyConsole(ctx context.Context, console console.Console, | |||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			return nil, err | 			return nil, err | ||||||
| 		} | 		} | ||||||
|  | 		cmd := process.NewBinaryCmd(uri, id, ns) | ||||||
| 		cmd := runtime.NewBinaryCmd(uri, id, ns) |  | ||||||
|  |  | ||||||
| 		// In case of unexpected errors during logging binary start, close open pipes | 		// In case of unexpected errors during logging binary start, close open pipes | ||||||
| 		var filesToClose []*os.File | 		var filesToClose []*os.File | ||||||
|  |  | ||||||
| 		defer func() { | 		defer func() { | ||||||
| 			if retErr != nil { | 			if retErr != nil { | ||||||
| 				runtime.CloseFiles(filesToClose...) | 				process.CloseFiles(filesToClose...) | ||||||
| 			} | 			} | ||||||
| 		}() | 		}() | ||||||
|  |  | ||||||
|   | |||||||
| @@ -28,8 +28,8 @@ import ( | |||||||
|  |  | ||||||
| 	"github.com/containerd/console" | 	"github.com/containerd/console" | ||||||
| 	"github.com/containerd/containerd/namespaces" | 	"github.com/containerd/containerd/namespaces" | ||||||
|  | 	"github.com/containerd/containerd/pkg/process" | ||||||
| 	"github.com/containerd/containerd/pkg/stdio" | 	"github.com/containerd/containerd/pkg/stdio" | ||||||
| 	"github.com/containerd/containerd/runtime" |  | ||||||
| 	"github.com/containerd/fifo" | 	"github.com/containerd/fifo" | ||||||
| 	"github.com/pkg/errors" | 	"github.com/pkg/errors" | ||||||
| ) | ) | ||||||
| @@ -99,14 +99,14 @@ func (p *linuxPlatform) CopyConsole(ctx context.Context, console console.Console | |||||||
| 			return nil, err | 			return nil, err | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		cmd := runtime.NewBinaryCmd(uri, id, ns) | 		cmd := process.NewBinaryCmd(uri, id, ns) | ||||||
|  |  | ||||||
| 		// In case of unexpected errors during logging binary start, close open pipes | 		// In case of unexpected errors during logging binary start, close open pipes | ||||||
| 		var filesToClose []*os.File | 		var filesToClose []*os.File | ||||||
|  |  | ||||||
| 		defer func() { | 		defer func() { | ||||||
| 			if retErr != nil { | 			if retErr != nil { | ||||||
| 				runtime.CloseFiles(filesToClose...) | 				process.CloseFiles(filesToClose...) | ||||||
| 			} | 			} | ||||||
| 		}() | 		}() | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Shiming Zhang
					Shiming Zhang