@@ -79,6 +79,7 @@ var generateFlags = []cli.Flag{
7979 cli.StringSliceFlag {Name : "process-cap-add" , Usage : "add Linux capabilities" },
8080 cli.StringSliceFlag {Name : "process-cap-drop" , Usage : "drop Linux capabilities" },
8181 cli.BoolFlag {Name : "process-cap-drop-all" , Usage : "drop all Linux capabilities" },
82+ cli.StringFlag {Name : "process-consolesize" , Usage : "specifies the console size in characters (width:height)" },
8283 cli.StringFlag {Name : "process-cwd" , Value : "/" , Usage : "current working directory for the process" },
8384 cli.IntFlag {Name : "process-gid" , Usage : "gid for the process" },
8485 cli.StringSliceFlag {Name : "process-groups" , Usage : "supplementary groups for the process" },
@@ -276,6 +277,15 @@ func setupSpec(g *generate.Generator, context *cli.Context) error {
276277 }
277278 }
278279
280+ if context .IsSet ("process-consolesize" ) {
281+ consoleSize := context .String ("process-consolesize" )
282+ width , height , err := parseConsoleSize (consoleSize )
283+ if err != nil {
284+ return err
285+ }
286+ g .SetProcessConsoleSize (width , height )
287+ }
288+
279289 if context .Bool ("process-cap-drop-all" ) {
280290 g .ClearProcessCapabilities ()
281291 }
@@ -561,6 +571,25 @@ func setupSpec(g *generate.Generator, context *cli.Context) error {
561571 return err
562572}
563573
574+ func parseConsoleSize (consoleSize string ) (uint , uint , error ) {
575+ size := strings .Split (consoleSize , ":" )
576+ if len (size ) != 2 {
577+ return 0 , 0 , fmt .Errorf ("invalid consolesize value: %s" , consoleSize )
578+ }
579+
580+ width , err := strconv .Atoi (size [0 ])
581+ if err != nil {
582+ return 0 , 0 , err
583+ }
584+
585+ height , err := strconv .Atoi (size [1 ])
586+ if err != nil {
587+ return 0 , 0 , err
588+ }
589+
590+ return uint (width ), uint (height ), nil
591+ }
592+
564593func parseIDMapping (idms string ) (uint32 , uint32 , uint32 , error ) {
565594 idm := strings .Split (idms , ":" )
566595 if len (idm ) != 3 {
0 commit comments