@@ -18,6 +18,7 @@ package tasks
1818
1919import (
2020 "errors"
21+ "net/url"
2122
2223 "github.com/containerd/console"
2324 "github.com/containerd/containerd/cio"
@@ -53,6 +54,10 @@ var execCommand = cli.Command{
5354 Name : "fifo-dir" ,
5455 Usage : "directory used for storing IO FIFOs" ,
5556 },
57+ cli.StringFlag {
58+ Name : "log-uri" ,
59+ Usage : "log uri for custom shim logging" ,
60+ },
5661 },
5762 Action : func (context * cli.Context ) error {
5863 var (
@@ -86,11 +91,22 @@ var execCommand = cli.Command{
8691 pspec .Terminal = tty
8792 pspec .Args = args
8893
89- cioOpts := []cio.Opt {cio .WithStdio , cio .WithFIFODir (context .String ("fifo-dir" ))}
90- if tty {
91- cioOpts = append (cioOpts , cio .WithTerminal )
94+ var ioCreator cio.Creator
95+
96+ if logURI := context .String ("log-uri" ); logURI != "" {
97+ uri , err := url .Parse (logURI )
98+ if err != nil {
99+ return err
100+ }
101+ ioCreator = cio .LogURI (uri )
102+ } else {
103+ cioOpts := []cio.Opt {cio .WithStdio , cio .WithFIFODir (context .String ("fifo-dir" ))}
104+ if tty {
105+ cioOpts = append (cioOpts , cio .WithTerminal )
106+ }
107+ ioCreator = cio .NewCreator (cioOpts ... )
92108 }
93- ioCreator := cio . NewCreator ( cioOpts ... )
109+
94110 process , err := task .Exec (ctx , context .String ("exec-id" ), pspec , ioCreator )
95111 if err != nil {
96112 return err
0 commit comments