@@ -1598,7 +1598,15 @@ impl<'test> TestCx<'test> {
1598
1598
}
1599
1599
1600
1600
fn exec_compiled_test ( & self ) -> ProcRes {
1601
- let env = & self . props . exec_env ;
1601
+ let prepare_env = |cmd : & mut Command | {
1602
+ for key in & self . props . unset_exec_env {
1603
+ cmd. env_remove ( key) ;
1604
+ }
1605
+
1606
+ for ( key, val) in & self . props . exec_env {
1607
+ cmd. env ( key, val) ;
1608
+ }
1609
+ } ;
1602
1610
1603
1611
let proc_res = match & * self . config . target {
1604
1612
// This is pretty similar to below, we're transforming:
@@ -1635,10 +1643,7 @@ impl<'test> TestCx<'test> {
1635
1643
. args ( support_libs)
1636
1644
. args ( args) ;
1637
1645
1638
- for key in & self . props . unset_exec_env {
1639
- test_client. env_remove ( key) ;
1640
- }
1641
- test_client. envs ( env. clone ( ) ) ;
1646
+ prepare_env ( & mut test_client) ;
1642
1647
1643
1648
self . compose_and_run (
1644
1649
test_client,
@@ -1653,10 +1658,7 @@ impl<'test> TestCx<'test> {
1653
1658
let mut wr_run = Command :: new ( "wr-run" ) ;
1654
1659
wr_run. args ( & [ & prog] ) . args ( args) ;
1655
1660
1656
- for key in & self . props . unset_exec_env {
1657
- wr_run. env_remove ( key) ;
1658
- }
1659
- wr_run. envs ( env. clone ( ) ) ;
1661
+ prepare_env ( & mut wr_run) ;
1660
1662
1661
1663
self . compose_and_run (
1662
1664
wr_run,
@@ -1671,10 +1673,7 @@ impl<'test> TestCx<'test> {
1671
1673
let mut program = Command :: new ( & prog) ;
1672
1674
program. args ( args) . current_dir ( & self . output_base_dir ( ) ) ;
1673
1675
1674
- for key in & self . props . unset_exec_env {
1675
- program. env_remove ( key) ;
1676
- }
1677
- program. envs ( env. clone ( ) ) ;
1676
+ prepare_env ( & mut program) ;
1678
1677
1679
1678
self . compose_and_run (
1680
1679
program,
0 commit comments