@@ -6,6 +6,7 @@ use gtk::{
66} ;
77use vte4:: prelude:: * ;
88
9+ use crate :: fakers:: resolve_host_env_list_via_runner;
910use crate :: i18n:: gettext;
1011use crate :: gtk_utils:: ColorPalette ;
1112use crate :: models:: Container ;
@@ -159,27 +160,42 @@ impl IntegratedTerminal {
159160 }
160161
161162 imp. reload_button . set_visible ( false ) ;
162- let root_store = self . container ( ) . root_store ( ) ;
163-
164- // Prepare the shell command via the Distrobox backend (uses injected factory)
165- let name = self . container ( ) . name ( ) ;
166- let enter_cmd = root_store. distrobox ( ) . enter_cmd ( & name) ;
167- let shell = root_store. command_runner ( ) . wrap_command ( enter_cmd) . to_vec ( ) ;
168-
169- let fut = imp. terminal . spawn_future (
170- vte4:: PtyFlags :: DEFAULT ,
171- None ,
172- & shell. iter ( ) . filter_map ( |s| s. to_str ( ) ) . collect :: < Vec < _ > > ( ) ,
173- & [ ] ,
174- glib:: SpawnFlags :: DEFAULT ,
175- || { } ,
176- 10 ,
177- ) ;
178-
179163 glib:: MainContext :: default ( ) . spawn_local ( clone ! (
180164 #[ weak( rename_to=this) ]
181165 self ,
182166 async move {
167+ let root_store = this. container( ) . root_store( ) ;
168+
169+ // Prepare the shell command via the Distrobox backend (uses injected factory)
170+ let name = this. container( ) . name( ) ;
171+ let enter_cmd = root_store. distrobox( ) . enter_cmd( & name) ;
172+ let command_runner = root_store. command_runner( ) ;
173+ let shell = command_runner. wrap_command( enter_cmd) . to_vec( ) ;
174+ let shell_args = shell
175+ . iter( )
176+ . filter_map( |s| s. to_str( ) )
177+ . collect:: <Vec <_>>( ) ;
178+
179+ let host_env = match resolve_host_env_list_via_runner( & command_runner) . await {
180+ Ok ( env) => env,
181+ Err ( err) => {
182+ eprintln!( "Failed to resolve host env for terminal: {}" , err) ;
183+ Vec :: new( )
184+ }
185+ } ;
186+ let host_env_refs = host_env. iter( ) . map( String :: as_str) . collect:: <Vec <_>>( ) ;
187+
188+ dbg!( & host_env_refs) ;
189+ let fut = this. imp( ) . terminal. spawn_future(
190+ vte4:: PtyFlags :: DEFAULT ,
191+ None ,
192+ & shell_args,
193+ & host_env_refs,
194+ glib:: SpawnFlags :: DEFAULT ,
195+ || { } ,
196+ 10 ,
197+ ) ;
198+
183199 match fut. await {
184200 Ok ( pid) => {
185201 this. imp( ) . terminal_pid. set( Some ( pid) ) ;
0 commit comments