Skip to content

Commit

Permalink
Merge pull request #68 from thokuest/windows-svn-compatibility
Browse files Browse the repository at this point in the history
Fix for issue #39 - SVN release on windows
  • Loading branch information
townsfolk committed Jan 25, 2015
2 parents 65cb6b5 + 587d40e commit 3f75851
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/main/groovy/release/PluginHelper.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,18 @@ class PluginHelper {
* @return command "stdout" output
*/
String exec(boolean failOnStderr = true, Map env = [:], File directory = null, String... commands) {

def out = new StringBuffer()
def err = new StringBuffer()
def logMessage = "Running \"${commands.join(' ')}\"${ directory ? ' in [' + directory.canonicalPath + ']' : '' }"
def process = (env || directory) ?
(commands as List).execute(env.collect { "$it.key=$it.value" } as String[], directory) :
(commands as List).execute()

def process = null;

if (env || directory) {
def processEnv = env << System.getenv();
process = (commands as List).execute(processEnv.collect { "$it.key=$it.value" } as String[], directory)
} else {
process = (commands as List).execute();
}

log.info(logMessage)

Expand All @@ -94,12 +99,14 @@ class PluginHelper {

if (err.toString()) {
def message = "$logMessage produced an error: [${err.toString().trim()}]"

if (failOnStderr) {
throw new GradleException(message)
} else {
log.warn(message)
}
}

out.toString()
}

Expand Down

0 comments on commit 3f75851

Please sign in to comment.