@@ -628,6 +628,20 @@ async def __setup_env_for_matlab(self) -> dict:
628
628
629
629
return matlab_env
630
630
631
+ def __filter_env_variables (env_vars : dict [str , str ], prefix : str ) -> dict [str , str ]:
632
+ """Removes the keys that starts with the prefix supplied to this function
633
+
634
+ Args:
635
+ env_vars (dict[str, str]): dict to be filtered
636
+ prefix (str): starting characters of the keys to be removed
637
+
638
+ Returns:
639
+ dict[str, str]: dict with filtered keys
640
+ """
641
+ return {
642
+ key : value for key , value in env_vars .items () if not key .startswith (prefix )
643
+ }
644
+
631
645
async def __start_xvfb_process (self ):
632
646
"""Private method to start the xvfb process. Will set appropriate
633
647
errors to self.error and return None when any exceptions are raised.
@@ -639,9 +653,14 @@ async def __start_xvfb_process(self):
639
653
# Start Xvfb process and update display number in settings
640
654
create_xvfb_cmd = self .settings ["create_xvfb_cmd" ]
641
655
xvfb_cmd , dpipe = create_xvfb_cmd ()
656
+ filtered_env_variables = AppState .__filter_env_variables (
657
+ os .environ .copy (), "MWI_"
658
+ )
642
659
643
660
try :
644
- xvfb , display_port = await mw .create_xvfb_process (xvfb_cmd , dpipe )
661
+ xvfb , display_port = await mw .create_xvfb_process (
662
+ xvfb_cmd , dpipe , filtered_env_variables
663
+ )
645
664
self .settings ["matlab_display" ] = ":" + str (display_port )
646
665
647
666
logger .debug (f"Started Xvfb with PID={ xvfb .pid } on DISPLAY={ display_port } " )
0 commit comments