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