File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ toolbox\-run - Run a command in an existing toolbox container
5
5
6
6
## SYNOPSIS
7
7
** toolbox run** [ * --container NAME* | * -c NAME* ]
8
- [ * --release RELEASE* | * -r RELEASE* ] [ * COMMAND* ]
8
+ [ * --release RELEASE* | * -r RELEASE* ]
9
+ [ * --no-tty* | * -T* ] [ * COMMAND* ]
9
10
10
11
## DESCRIPTION
11
12
@@ -34,6 +35,10 @@ or entirely customized containers created from custom-built base images.
34
35
Run command inside a toolbox container for a different operating system
35
36
RELEASE than the host.
36
37
38
+ ** --no-tty** , ** -T**
39
+
40
+ Don't allocate pseudo-TTY.
41
+
37
42
## EXAMPLES
38
43
39
44
### Run ls inside a toolbox container using the default image matching the host OS
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
@@ -53,6 +54,12 @@ func init() {
53
54
"" ,
54
55
"Run command inside a toolbox container with the given name." )
55
56
57
+ flags .BoolVarP (& runFlags .noTty ,
58
+ "no-tty" ,
59
+ "T" ,
60
+ false ,
61
+ "Run command without allocating a pseudo-TTY." )
62
+
56
63
flags .StringVarP (& runFlags .release ,
57
64
"release" ,
58
65
"r" ,
@@ -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_container_old_v2=""
72
72
toolbox_container_prefix_default=" "
73
73
toolbox_hostname=toolbox
74
74
toolbox_image=" "
75
+ toolbox_run_with_tty=true
75
76
toolbox_runtime_directory=" $XDG_RUNTIME_DIR " /toolbox
76
77
user_id_real=$( id -ru 2>&3 )
77
78
verbose=false
@@ -1585,13 +1586,17 @@ run()
1585
1586
1586
1587
$emit_escape_sequence && printf " \033]777;container;push;%s;toolbox\033\\ " " $toolbox_container "
1587
1588
1589
+ extra_podman_args=()
1590
+ if " ${toolbox_run_with_tty} " ; then
1591
+ extra_podman_args+=(--tty)
1592
+ fi
1588
1593
# shellcheck disable=SC2016
1589
1594
# for the command passed to capsh
1590
1595
# shellcheck disable=SC2086
1591
1596
$podman_command exec \
1592
1597
--interactive \
1593
- --tty \
1594
1598
--user " $USER " \
1599
+ " ${extra_podman_args[@]} " \
1595
1600
--workdir " $PWD " \
1596
1601
$set_environment \
1597
1602
" $toolbox_container " \
@@ -2619,6 +2624,9 @@ case $op in
2619
2624
exit_if_non_positive_argument --release " $arg "
2620
2625
release=$arg
2621
2626
;;
2627
+ -T | --no-tty )
2628
+ toolbox_run_with_tty=false
2629
+ ;;
2622
2630
* )
2623
2631
exit_if_unrecognized_option " $1 "
2624
2632
esac
You can’t perform that action at this time.
0 commit comments