@@ -106,9 +106,19 @@ impl RunCommand {
106106 // Explicitly permit TCP sockets for the debugger-main environment.
107107 debugger_run. run . common . wasi . tcp = Some ( true ) ;
108108 debugger_run. run . common . wasi . inherit_network = Some ( true ) ;
109- // Do not inherit stdin/stdout (stderr is always
110- // inherited) in the debugger-main environment.
111- debugger_run. run . common . wasi . inherit_stdin_stdout = Some ( false ) ;
109+ // Copy over stdin/stdout/stderr inheritance settings,
110+ // except default to `false` for the debugger (so it
111+ // doesn't interfere with the debuggee's CLI interface, if
112+ // any). We expect most debug components will serve an
113+ // interface over the network; for those that want a TUI,
114+ // their setup instructions can instruct the user to set
115+ // these flags as needed.
116+ debugger_run. run . common . wasi . inherit_stdin =
117+ Some ( self . run . common . debug . stdin . unwrap_or ( false ) ) ;
118+ debugger_run. run . common . wasi . inherit_stdout =
119+ Some ( self . run . common . debug . stdout . unwrap_or ( false ) ) ;
120+ debugger_run. run . common . wasi . inherit_stderr =
121+ Some ( self . run . common . debug . stderr . unwrap_or ( false ) ) ;
112122 Ok ( Some ( debugger_run) )
113123 } else {
114124 Ok ( None )
@@ -1244,8 +1254,14 @@ impl RunCommand {
12441254 builder. args ( & self . compute_argv ( ) ?) ?;
12451255
12461256 builder. inherit_stderr ( ) ;
1247- if self . run . common . wasi . inherit_stdin_stdout . unwrap_or ( true ) {
1248- builder. inherit_stdin ( ) . inherit_stdout ( ) ;
1257+ if self . run . common . wasi . inherit_stdin . unwrap_or ( true ) {
1258+ builder. inherit_stdin ( ) ;
1259+ }
1260+ if self . run . common . wasi . inherit_stdout . unwrap_or ( true ) {
1261+ builder. inherit_stdout ( ) ;
1262+ }
1263+ if self . run . common . wasi . inherit_stderr . unwrap_or ( true ) {
1264+ builder. inherit_stderr ( ) ;
12491265 }
12501266
12511267 if self . run . common . wasi . inherit_env == Some ( true ) {
0 commit comments