|
@@ -60,7 +60,10 @@ public class ScriptUtil {
|
|
|
// 标准输出:print (null if watchdog timeout)
|
|
|
// 错误输出:logging + 异常 (still exists if watchdog timeout)
|
|
|
// 标准输入
|
|
|
- try (FileOutputStream fileOutputStream = new FileOutputStream(logFile, true)) {
|
|
|
+
|
|
|
+ FileOutputStream fileOutputStream = null; //
|
|
|
+ try {
|
|
|
+ fileOutputStream = new FileOutputStream(logFile, true);
|
|
|
PumpStreamHandler streamHandler = new PumpStreamHandler(fileOutputStream, fileOutputStream, null);
|
|
|
|
|
|
// command
|
|
@@ -79,6 +82,15 @@ public class ScriptUtil {
|
|
|
} catch (Exception e) {
|
|
|
XxlJobLogger.log(e);
|
|
|
return -1;
|
|
|
+ } finally {
|
|
|
+ if (fileOutputStream != null) {
|
|
|
+ try {
|
|
|
+ fileOutputStream.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ XxlJobLogger.log(e);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|