mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 23:45:44 +01:00
use system environment when executing "hg create"
This commit is contained in:
@@ -105,6 +105,21 @@ public class SimpleCommand implements Command
|
||||
return getResult(process);
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @since 1.23
|
||||
*/
|
||||
public boolean isUseSystemEnvironment()
|
||||
{
|
||||
return useSystemEnvironment;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -119,6 +134,19 @@ public class SimpleCommand implements Command
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param useSystemEnvironment
|
||||
*
|
||||
* @since 1.23
|
||||
*/
|
||||
public void setUseSystemEnvironment(boolean useSystemEnvironment)
|
||||
{
|
||||
this.useSystemEnvironment = useSystemEnvironment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -162,9 +190,15 @@ public class SimpleCommand implements Command
|
||||
processBuilder = processBuilder.directory(workDirectory);
|
||||
}
|
||||
|
||||
Map<String,String> env = processBuilder.environment();
|
||||
if ( useSystemEnvironment )
|
||||
{
|
||||
env.putAll(System.getenv());
|
||||
}
|
||||
|
||||
if (environment != null)
|
||||
{
|
||||
processBuilder.environment().putAll(environment);
|
||||
env.putAll(environment);
|
||||
}
|
||||
|
||||
return processBuilder.redirectErrorStream(true).start();
|
||||
@@ -244,6 +278,9 @@ public class SimpleCommand implements Command
|
||||
/** Field description */
|
||||
private Map<String, String> environment;
|
||||
|
||||
/** Field description */
|
||||
private boolean useSystemEnvironment = false;
|
||||
|
||||
/** Field description */
|
||||
private File workDirectory;
|
||||
}
|
||||
|
||||
@@ -546,6 +546,9 @@ public class HgRepositoryHandler
|
||||
ExtendedCommand cmd = new ExtendedCommand(config.getHgBinary(), "init",
|
||||
directory.getAbsolutePath());
|
||||
|
||||
// copy system environment, because of the PATH variable
|
||||
cmd.setUseSystemEnvironment(true);
|
||||
|
||||
// issue-97
|
||||
cmd.setWorkDirectory(baseDirectory);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user