[maven-debian-helper] 14/21: Update SysInstallMojo to wait for symlinks to finish

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Fri Nov 13 15:05:46 UTC 2015


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to branch maven-debian-helper-2.0
in repository maven-debian-helper.

commit 6a900fbf1f8d30283de39be1c415e6b68ab7ebfd
Author: Andrew Schurman <arcticwaters at gmail.com>
Date:   Fri Mar 20 01:54:21 2015 -0700

    Update SysInstallMojo to wait for symlinks to finish
    
    This fixes a bug with tests where slow hard disks/computers can cause
    tests to fail due to assertions being run before the symlink process
    completes.
---
 .../java/org/debian/maven/plugin/SysInstallMojo.java     | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/debian-maven-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java b/debian-maven-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java
index 0c2b0f9..fa39016 100644
--- a/debian-maven-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java
+++ b/debian-maven-plugin/src/main/java/org/debian/maven/plugin/SysInstallMojo.java
@@ -534,17 +534,19 @@ public class SysInstallMojo extends AbstractMojo {
      * command for creating the relative symlink
      */
     private void link(String target, String linkName) throws IOException {
+        Process process;
         if (System.getProperty("os.name").contains("Windows")) {
             File linkNameFile = new File(linkName).getAbsoluteFile();
             linkNameFile.getParentFile().mkdirs();
-            Process process = new ProcessBuilder().command("cmd", "/C", "mklink", linkNameFile.getAbsolutePath(), target.replace('/', '\\')).start();
-            try {
-                process.waitFor();
-            } catch (InterruptedException e) {
-                throw new IOException(e);
-            }
+            process = new ProcessBuilder().command("cmd", "/C", "mklink", linkNameFile.getAbsolutePath(), target.replace('/', '\\')).start();
         } else {
-            Runtime.getRuntime().exec(new String[]{"ln", "-s", target, linkName}, null);
+            process = new ProcessBuilder().command("ln", "-s", target, linkName).start();
+        }
+
+        try {
+            process.waitFor();
+        } catch (InterruptedException e) {
+            throw new IOException(e);
         }
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/maven-debian-helper.git



More information about the pkg-java-commits mailing list