Skip to content

Commit 7a48335

Browse files
committed
Handle micromamba special cases.
1 parent 255b333 commit 7a48335

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

src/main/java/fiji/plugin/trackmate/util/cli/CLIUtils.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ public static final Process createProcess( final CLIConfigurator cli, final File
7575
{
7676
final List< String > cmd = CommandBuilder.build( cli );
7777
final ProcessBuilder pb = new ProcessBuilder( cmd );
78+
if ( cli instanceof CondaCLIConfigurator )
79+
{
80+
// Env variables.
81+
final Map< String, String > env = new HashMap<>();
82+
final String condaRootPrefix = getCondaRootPrefix();
83+
env.put( "MAMBA_ROOT_PREFIX", condaRootPrefix );
84+
env.put( "CONDA_ROOT_PREFIX", condaRootPrefix );
85+
pb.environment().putAll( env );
86+
}
7887
pb.redirectOutput( ProcessBuilder.Redirect.appendTo( logFile ) );
7988
pb.redirectError( ProcessBuilder.Redirect.appendTo( logFile ) );
8089
return pb.start();

src/main/java/fiji/plugin/trackmate/util/cli/CondaCLIConfigurator.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,11 @@ protected CondaCLIConfigurator()
141141
// The executable stuff.
142142
final String envname = ( String ) s;
143143
cmd.add( envname );
144-
// Important: don't buffer output
145-
cmd.add( "--no-capture-output" );
144+
// Only add these flags for conda/mamba, NOT for micromamba
145+
if ( !isMicromamba( condaPath ) )
146+
{
147+
cmd.add( "--no-capture-output" );
148+
}
146149
// The rest of the command, split by spaces.
147150
final String executableCommand = getCommand();
148151
final String[] split = executableCommand.split( " " );
@@ -151,6 +154,11 @@ protected CondaCLIConfigurator()
151154
} );
152155
}
153156

157+
private static boolean isMicromamba( final String path )
158+
{
159+
return path != null && path.toLowerCase().contains( "micromamba" );
160+
}
161+
154162
@Override
155163
public CondaEnvironmentCommand getCommandArg()
156164
{

0 commit comments

Comments
 (0)