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
@@ -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
+ "no-tty" ,
65
+ "T" ,
66
+ false ,
67
+ "Run command without allocating a pseudo-TTY." )
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 @@ -71,6 +71,7 @@ toolbox_container_prefix_default=""
71
71
toolbox_image=" "
72
72
toolbox_runtime_directory=" $XDG_RUNTIME_DIR " /toolbox
73
73
user_id_real=$( id -ru 2>&3 )
74
+ tty=true
74
75
verbose=false
75
76
76
77
@@ -1582,13 +1583,17 @@ 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 " $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
- --tty \
1591
1595
--user " $USER " \
1596
+ " ${extra_podman_args[@]} " \
1592
1597
--workdir " $PWD " \
1593
1598
$set_environment \
1594
1599
" $toolbox_container " \
@@ -2611,6 +2616,9 @@ case $op in
2611
2616
exit_if_non_positive_argument --release " $arg "
2612
2617
release=$arg
2613
2618
;;
2619
+ -T | --no-tty )
2620
+ tty=false
2621
+ ;;
2614
2622
* )
2615
2623
exit_if_unrecognized_option " $1 "
2616
2624
esac
You can’t perform that action at this time.
0 commit comments