From b7935a9323d4dc3185744246ab2ac32402b4092b Mon Sep 17 00:00:00 2001 From: "xueli.xue" Date: Thu, 27 Apr 2017 20:29:15 +0800 Subject: [PATCH] =?UTF-8?q?shell=E8=84=9A=E6=9C=AC"\r"=E9=97=AE=E9=A2=98fi?= =?UTF-8?q?x?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/service/impl/XxlJobServiceImpl.java | 5 +++++ .../template/jobinfo/jobinfo.index.ftl | 20 ++++++++++--------- .../com/xxl/job/core/thread/JobThread.java | 4 ++-- .../com/xxl/job/core/util/ScriptUtil.java | 2 +- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java index 16e84125..c9d3a5e6 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java @@ -89,6 +89,11 @@ public class XxlJobServiceImpl implements IXxlJobService { return new ReturnT(500, "请输入“JobHandler”"); } + // fix "\r" in shell + if (GlueTypeEnum.GLUE_SHELL==GlueTypeEnum.match(jobInfo.getGlueType()) && jobInfo.getGlueSource()!=null) { + jobInfo.setGlueSource(jobInfo.getGlueSource().replaceAll("\r", "")); + } + // childJobKey valid if (StringUtils.isNotBlank(jobInfo.getChildJobKey())) { String[] childJobKeys = jobInfo.getChildJobKey().split(","); diff --git a/xxl-job-admin/src/main/webapp/WEB-INF/template/jobinfo/jobinfo.index.ftl b/xxl-job-admin/src/main/webapp/WEB-INF/template/jobinfo/jobinfo.index.ftl index 38614b87..c85bbcc5 100644 --- a/xxl-job-admin/src/main/webapp/WEB-INF/template/jobinfo/jobinfo.index.ftl +++ b/xxl-job-admin/src/main/webapp/WEB-INF/template/jobinfo/jobinfo.index.ftl @@ -208,19 +208,21 @@ exit 0 diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/thread/JobThread.java b/xxl-job-core/src/main/java/com/xxl/job/core/thread/JobThread.java index f27aaa88..b0cfb971 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/thread/JobThread.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/thread/JobThread.java @@ -88,7 +88,7 @@ public class JobThread extends Thread{ } } catch (Exception e) { if (toStop) { - logger.error("----------- xxl-job toStop, stopReason:{}", stopReason); + logger.error("
----------- xxl-job toStop, stopReason:{}", stopReason); } logger.error("JobThread Exception:", e); StringWriter out = new StringWriter(); @@ -111,7 +111,7 @@ public class JobThread extends Thread{ } } catch (Exception e) { if (toStop) { - logger.error("----------- xxl-job toStop, stopReason:{}", stopReason); + logger.error("
----------- xxl-job toStop, stopReason:{}", stopReason); } logger.error("----------- xxl-job JobThread Exception:", e); } diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/util/ScriptUtil.java b/xxl-job-core/src/main/java/com/xxl/job/core/util/ScriptUtil.java index e5a8b054..04fad6e4 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/util/ScriptUtil.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/util/ScriptUtil.java @@ -87,7 +87,7 @@ public class ScriptUtil { DefaultExecutor exec = new DefaultExecutor(); exec.setExitValues(null); exec.setStreamHandler(streamHandler); - int exitValue = exec.execute(commandline); // exit code: 0=success, 1/-1=fail + int exitValue = exec.execute(commandline); // exit code: 0=success, 1=error return exitValue; }