diff --git a/WHATSNEW b/WHATSNEW index c6c95c69e..4ab275eaa 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -46,6 +46,9 @@ Fixed bugs: * task couldn't overwrite files that were in the way of the symlink. Bugzilla report 43426. + + * task failonerror="false" does not stop build from failing when 'ln' + command returns non-zero. Bugzilla report 43624 * task couldn't differentiate between "no resources specified" and "no resources matched." Bugzilla report 43799. diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java b/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java index 7b63cf5b1..bf1f86aa5 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java @@ -443,6 +443,7 @@ public class Symlink extends DispatchTask { * * @param properties The properties object to be written. * @param dir The directory for which we are writing the links. + * @throws BuildException if the property file could not be written */ private void writePropertyFile(Properties properties, File dir) throws BuildException { @@ -498,7 +499,16 @@ public class Symlink extends DispatchTask { } } String[] cmd = new String[] {"ln", options, res, lnk}; - Execute.runCommand(this, cmd); + try { + Execute.runCommand(this, cmd); + } catch (BuildException failedToExecute) { + if(failonerror) { + throw failedToExecute; + } else { + //log at the info level, and keep going. + log(failedToExecute.getMessage(), failedToExecute, Project.MSG_INFO); + } + } } /**