Commit 34119957 authored by Dave Syer's avatar Dave Syer

Revert BootRunTask changes since they don't add anything

(Was an attempt to get Cygwin to recognise the interrupt, but it seems
to be doomed so not worth having the extra code in there really.)
parent e088ecd1
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
package org.springframework.boot.gradle.run; package org.springframework.boot.gradle.run;
import java.io.File; import java.io.File;
import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
...@@ -26,11 +25,7 @@ import java.util.Set; ...@@ -26,11 +25,7 @@ import java.util.Set;
import org.gradle.api.internal.file.collections.SimpleFileCollection; import org.gradle.api.internal.file.collections.SimpleFileCollection;
import org.gradle.api.tasks.JavaExec; import org.gradle.api.tasks.JavaExec;
import org.gradle.api.tasks.SourceSet; import org.gradle.api.tasks.SourceSet;
import org.gradle.process.ExecResult;
import org.gradle.process.internal.DefaultJavaExecAction;
import org.gradle.process.internal.ExecHandle;
import org.springframework.boot.loader.tools.FileUtils; import org.springframework.boot.loader.tools.FileUtils;
import org.springframework.util.ReflectionUtils;
/** /**
* Extension of the standard 'run' task with additional Spring Boot features. * Extension of the standard 'run' task with additional Spring Boot features.
...@@ -58,37 +53,7 @@ public class BootRunTask extends JavaExec { ...@@ -58,37 +53,7 @@ public class BootRunTask extends JavaExec {
FileUtils.removeDuplicatesFromOutputDirectory(outputDir, directory); FileUtils.removeDuplicatesFromOutputDirectory(outputDir, directory);
} }
} }
try { super.exec();
executeReflectively();
} catch (Exception e) {
getLogger().info("Cannot execute action reflectively");
super.exec();
}
}
private ExecResult executeReflectively() throws Exception {
Field builder = ReflectionUtils.findField(JavaExec.class, "javaExecHandleBuilder");
builder.setAccessible(true);
DefaultJavaExecAction action = (DefaultJavaExecAction) builder.get(this);
setMain(getMain());
final ExecHandle execHandle = action.build();
try {
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
getLogger().info("Aborting java sub-process");
execHandle.abort();
}
}));
} catch (Exception e) {
getLogger().warn("Could not attach shutdown hook (child process may be orphaned)");
}
ExecResult execResult = execHandle.start().waitForFinish();
if (!isIgnoreExitValue()) {
execResult.assertNormalExitValue();
}
return execResult;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment