Permalink
Browse files

Use getWorkSpace instead of getModuleRoot to set the working directory

Some SCMs (e.g. SVN) support checking out multiple modules into the same
workspace. In that case the getModuleRoot is not deterministic anymore.
Even if only one module is checked out, the Module Root is not
necessarily the same as the Work Space directory. So explicitly use
getWorkSpace to conform to the documented behavior: "the current working
directory of the command execution is always the job's workspace root."
  • Loading branch information...
1 parent a13e799 commit 8d0afa98ba479317709e89512f59f4aca827243f @vsnijders vsnijders committed Nov 2, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/main/java/hudson/plugins/xshell/XShellBuilder.java
@@ -97,11 +97,11 @@ public boolean perform(final AbstractBuild<?, ?> build, final Launcher launcher,
LOG.log(Level.FINEST, "Environment variables: " + env.entrySet().toString());
LOG.log(Level.FINE, "Command line: " + args.toStringWithQuote());
- LOG.log(Level.FINE, "Working directory: " + build.getModuleRoot());
+ LOG.log(Level.FINE, "Working directory: " + build.getWorkspace());
try {
final int result = launcher.decorateFor(build.getBuiltOn()).launch()
- .cmds(args).envs(env).stdout(listener).pwd(build.getModuleRoot()).join();
+ .cmds(args).envs(env).stdout(listener).pwd(build.getWorkspace()).join();
return result == 0;
} catch (final IOException e) {
Util.displayIOException(e, listener);

1 comment on commit 8d0afa9

@davehunt
Contributor

I believe this has caused a regression where the repository is cloned to a subdirectory.

Please sign in to comment.