Skip to content

Commit 3411995

Browse files
author
Dave Syer
committed
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.)
1 parent e088ecd commit 3411995

File tree

1 file changed

+1
-36
lines changed
  • spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/run

1 file changed

+1
-36
lines changed

spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/run/BootRunTask.java

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package org.springframework.boot.gradle.run;
1818

1919
import java.io.File;
20-
import java.lang.reflect.Field;
2120
import java.util.ArrayList;
2221
import java.util.LinkedHashSet;
2322
import java.util.List;
@@ -26,11 +25,7 @@
2625
import org.gradle.api.internal.file.collections.SimpleFileCollection;
2726
import org.gradle.api.tasks.JavaExec;
2827
import org.gradle.api.tasks.SourceSet;
29-
import org.gradle.process.ExecResult;
30-
import org.gradle.process.internal.DefaultJavaExecAction;
31-
import org.gradle.process.internal.ExecHandle;
3228
import org.springframework.boot.loader.tools.FileUtils;
33-
import org.springframework.util.ReflectionUtils;
3429

3530
/**
3631
* Extension of the standard 'run' task with additional Spring Boot features.
@@ -58,37 +53,7 @@ public void exec() {
5853
FileUtils.removeDuplicatesFromOutputDirectory(outputDir, directory);
5954
}
6055
}
61-
try {
62-
executeReflectively();
63-
} catch (Exception e) {
64-
getLogger().info("Cannot execute action reflectively");
65-
super.exec();
66-
}
67-
}
68-
69-
private ExecResult executeReflectively() throws Exception {
70-
Field builder = ReflectionUtils.findField(JavaExec.class, "javaExecHandleBuilder");
71-
builder.setAccessible(true);
72-
DefaultJavaExecAction action = (DefaultJavaExecAction) builder.get(this);
73-
setMain(getMain());
74-
final ExecHandle execHandle = action.build();
75-
try {
76-
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
77-
78-
@Override
79-
public void run() {
80-
getLogger().info("Aborting java sub-process");
81-
execHandle.abort();
82-
}
83-
}));
84-
} catch (Exception e) {
85-
getLogger().warn("Could not attach shutdown hook (child process may be orphaned)");
86-
}
87-
ExecResult execResult = execHandle.start().waitForFinish();
88-
if (!isIgnoreExitValue()) {
89-
execResult.assertNormalExitValue();
90-
}
91-
return execResult;
56+
super.exec();
9257
}
9358

9459
}

0 commit comments

Comments
 (0)