1. Sebastian Sdorra
  2. scm-manager

Commits

Sebastian Sdorra  committed ad5f297

use system environment when executing "hg create"

  • Participants
  • Parent commits 7ca06e3
  • Branches default

Comments (0)

Files changed (2)

File scm-core/src/main/java/sonia/scm/io/SimpleCommand.java

View file
  • Ignore whitespace
     return getResult(process);
   }
 
+  //~--- get methods ----------------------------------------------------------
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   * 
+   * @since 1.23
+   */
+  public boolean isUseSystemEnvironment()
+  {
+    return useSystemEnvironment;
+  }
+
   //~--- set methods ----------------------------------------------------------
 
   /**
    * Method description
    *
    *
+   * @param useSystemEnvironment
+   * 
+   * @since 1.23
+   */
+  public void setUseSystemEnvironment(boolean useSystemEnvironment)
+  {
+    this.useSystemEnvironment = useSystemEnvironment;
+  }
+
+  /**
+   * Method description
+   *
+   *
    * @param workDirectory
    */
   @Override
       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();
   private Map<String, String> environment;
 
   /** Field description */
+  private boolean useSystemEnvironment = false;
+
+  /** Field description */
   private File workDirectory;
 }

File scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/HgRepositoryHandler.java

View file
  • Ignore whitespace
     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);