|
@@ -60,7 +60,10 @@ public class ScriptUtil {
|
60
|
60
|
// 标准输出:print (null if watchdog timeout)
|
61
|
61
|
// 错误输出:logging + 异常 (still exists if watchdog timeout)
|
62
|
62
|
// 标准输入
|
63
|
|
- try (FileOutputStream fileOutputStream = new FileOutputStream(logFile, true)) {
|
|
63
|
+
|
|
64
|
+ FileOutputStream fileOutputStream = null; //
|
|
65
|
+ try {
|
|
66
|
+ fileOutputStream = new FileOutputStream(logFile, true);
|
64
|
67
|
PumpStreamHandler streamHandler = new PumpStreamHandler(fileOutputStream, fileOutputStream, null);
|
65
|
68
|
|
66
|
69
|
// command
|
|
@@ -79,6 +82,15 @@ public class ScriptUtil {
|
79
|
82
|
} catch (Exception e) {
|
80
|
83
|
XxlJobLogger.log(e);
|
81
|
84
|
return -1;
|
|
85
|
+ } finally {
|
|
86
|
+ if (fileOutputStream != null) {
|
|
87
|
+ try {
|
|
88
|
+ fileOutputStream.close();
|
|
89
|
+ } catch (IOException e) {
|
|
90
|
+ XxlJobLogger.log(e);
|
|
91
|
+ }
|
|
92
|
+
|
|
93
|
+ }
|
82
|
94
|
}
|
83
|
95
|
}
|
84
|
96
|
|