88 * it under the terms of the GNU General Public License as
99 * published by the Free Software Foundation, either version 3 of the
1010 * License, or (at your option) any later version.
11- *
11+ *
1212 * This program is distributed in the hope that it will be useful,
1313 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1414 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1515 * GNU General Public License for more details.
16- *
16+ *
1717 * You should have received a copy of the GNU General Public
1818 * License along with this program. If not, see
1919 * <http://www.gnu.org/licenses/gpl-3.0.html>.
3434import java .nio .file .Paths ;
3535import java .time .Duration ;
3636import java .util .ArrayList ;
37+ import java .util .HashMap ;
3738import java .util .Iterator ;
3839import java .util .List ;
3940import java .util .Map ;
@@ -540,6 +541,13 @@ public String call() throws Exception
540541 {
541542 final ProcessBuilder pbOmni = new ProcessBuilder ( cmd );
542543 pbOmni .redirectErrorStream ( true );
544+ // Env variables.
545+ final Map < String , String > env = new HashMap <>();
546+ final String condaRootPrefix = CLIUtils .getCondaRootPrefix ();
547+ env .put ( "MAMBA_ROOT_PREFIX" , condaRootPrefix );
548+ env .put ( "CONDA_ROOT_PREFIX" , condaRootPrefix );
549+ pbOmni .environment ().putAll ( env );
550+
543551 process = pbOmni .start ();
544552
545553 final BufferedReader reader = new BufferedReader ( new InputStreamReader ( process .getInputStream () ) );
@@ -575,6 +583,7 @@ public String call() throws Exception
575583 final ProcessBuilder updatedPbOmni = new ProcessBuilder ( cmd2 );
576584 updatedPbOmni .redirectOutput ( ProcessBuilder .Redirect .INHERIT );
577585 updatedPbOmni .redirectError ( ProcessBuilder .Redirect .INHERIT );
586+ updatedPbOmni .environment ().putAll ( env );
578587
579588 process = updatedPbOmni .start ();
580589 process .waitFor ();
@@ -589,6 +598,12 @@ else if ( pythonErrorOutput.contains( "pretrained model has incorrect path" ) )
589598 final ProcessBuilder pb = new ProcessBuilder ( cmd );
590599 pb .redirectOutput ( ProcessBuilder .Redirect .INHERIT );
591600 pb .redirectError ( ProcessBuilder .Redirect .INHERIT );
601+ // Env variables.
602+ final Map < String , String > env = new HashMap <>();
603+ final String condaRootPrefix = CLIUtils .getCondaRootPrefix ();
604+ env .put ( "MAMBA_ROOT_PREFIX" , condaRootPrefix );
605+ env .put ( "CONDA_ROOT_PREFIX" , condaRootPrefix );
606+ pb .environment ().putAll ( env );
592607
593608 process = pb .start ();
594609 process .waitFor ();
0 commit comments