@@ -219,9 +219,9 @@ func getProcess(context *cli.Context, bundle string) (*specs.Process, error) {
219219 }
220220 p := spec .Process
221221 p .Args = context .Args ()[1 :]
222- // override the cwd, if passed
223- if context .String ("cwd" ) != "" {
224- p .Cwd = context . String ( " cwd" )
222+ // Override the cwd, if passed.
223+ if cwd := context .String ("cwd" ); cwd != "" {
224+ p .Cwd = cwd
225225 }
226226 if ap := context .String ("apparmor" ); ap != "" {
227227 p .ApparmorProfile = ap
@@ -240,27 +240,24 @@ func getProcess(context *cli.Context, bundle string) (*specs.Process, error) {
240240 // append the passed env variables
241241 p .Env = append (p .Env , context .StringSlice ("env" )... )
242242
243- // set the tty
244- p .Terminal = false
245- if context .IsSet ("tty" ) {
246- p .Terminal = context .Bool ("tty" )
247- }
243+ // Always set tty to false, unless explicitly enabled from CLI.
244+ p .Terminal = context .Bool ("tty" )
248245 if context .IsSet ("no-new-privs" ) {
249246 p .NoNewPrivileges = context .Bool ("no-new-privs" )
250247 }
251- // override the user, if passed
252- if context .String ("user" ) != "" {
253- u := strings .SplitN (context . String ( " user" ) , ":" , 2 )
248+ // Override the user, if passed.
249+ if user := context .String ("user" ); user != "" {
250+ u := strings .SplitN (user , ":" , 2 )
254251 if len (u ) > 1 {
255252 gid , err := strconv .Atoi (u [1 ])
256253 if err != nil {
257- return nil , fmt .Errorf ("parsing %s as int for gid failed : %w" , u [ 1 ] , err )
254+ return nil , fmt .Errorf ("bad gid: %w" , err )
258255 }
259256 p .User .GID = uint32 (gid )
260257 }
261258 uid , err := strconv .Atoi (u [0 ])
262259 if err != nil {
263- return nil , fmt .Errorf ("parsing %s as int for uid failed : %w" , u [ 0 ] , err )
260+ return nil , fmt .Errorf ("bad uid: %w" , err )
264261 }
265262 p .User .UID = uint32 (uid )
266263 }
0 commit comments