File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 34
34
runFlags struct {
35
35
container string
36
36
release string
37
+ notty bool
37
38
}
38
39
)
39
40
@@ -59,6 +60,12 @@ func init() {
59
60
"" ,
60
61
"Run command inside a toolbox container for a different operating system release than the host." )
61
62
63
+ flags .BoolVarP (& runFlags .notty ,
64
+ "notty" ,
65
+ "T" ,
66
+ false ,
67
+ "Run command without allocating a pseudo terminal." )
68
+
62
69
runCmd .SetHelpFunc (runHelp )
63
70
rootCmd .AddCommand (runCmd )
64
71
}
@@ -290,11 +297,14 @@ func runCommand(container string,
290
297
291
298
execArgs = append (execArgs , []string {
292
299
"--interactive" ,
293
- "--tty" ,
294
300
"--user" , currentUser .Username ,
295
301
"--workdir" , workingDirectory ,
296
302
}... )
297
303
304
+ if ! runFlags .notty {
305
+ execArgs = append (execArgs , "--tty" )
306
+ }
307
+
298
308
execArgs = append (execArgs , envOptions ... )
299
309
300
310
execArgs = append (execArgs , []string {
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ toolbox_image=""
72
72
toolbox_runtime_directory=" $XDG_RUNTIME_DIR " /toolbox
73
73
user_id_real=$( id -ru 2>&3 )
74
74
verbose=false
75
+ no_tty=false
75
76
76
77
77
78
LGC=' \033[1;32m' # Light Green Color
@@ -1582,13 +1583,18 @@ run()
1582
1583
1583
1584
$emit_escape_sequence && printf " \033]777;container;push;%s;toolbox\033\\ " " $toolbox_container "
1584
1585
1586
+ extra_podman_args=()
1587
+ if ! $no_tty ; then
1588
+ extra_podman_args+=(--tty)
1589
+ fi
1585
1590
# shellcheck disable=SC2016
1586
1591
# for the command passed to capsh
1587
1592
# shellcheck disable=SC2086
1588
1593
$podman_command exec \
1589
1594
--interactive \
1590
1595
--tty \
1591
1596
--user " $USER " \
1597
+ " ${extra_podman_args[@]} " \
1592
1598
--workdir " $PWD " \
1593
1599
$set_environment \
1594
1600
" $toolbox_container " \
@@ -2611,6 +2617,9 @@ case $op in
2611
2617
exit_if_non_positive_argument --release " $arg "
2612
2618
release=$arg
2613
2619
;;
2620
+ -T | --notty )
2621
+ no_tty=true
2622
+ ;;
2614
2623
* )
2615
2624
exit_if_unrecognized_option " $1 "
2616
2625
esac
You can’t perform that action at this time.
0 commit comments