格式化命令中的换行

This commit is contained in:
bwcx_jzy 2020-05-27 19:00:42 +08:00
parent 786df0d8e1
commit 458e967336
2 changed files with 6 additions and 2 deletions

View File

@ -11,6 +11,7 @@
3. 【Server】节点分发列表点击控制台、文件管理404 3. 【Server】节点分发列表点击控制台、文件管理404
4. 【Server】节点分发顺序重启休眠时间取构建名称最后的时间测试构建:10 则睡眠时间为10秒 4. 【Server】节点分发顺序重启休眠时间取构建名称最后的时间测试构建:10 则睡眠时间为10秒
5. 【Agent】启动完成打印授权信息日志级别调至error 5. 【Agent】启动完成打印授权信息日志级别调至error
6. CommandUtil.asyncExeLocalCommand 方法格式化命令中的换行
----------------------------------------------------------- -----------------------------------------------------------

View File

@ -113,9 +113,12 @@ public class CommandUtil {
* @throws IOException 异常 * @throws IOException 异常
*/ */
public static void asyncExeLocalCommand(File file, String command) throws Exception { public static void asyncExeLocalCommand(File file, String command) throws Exception {
DefaultSystemLog.getLog().info(command); String newCommand = StrUtil.replace(command, StrUtil.CRLF, StrUtil.SPACE);
newCommand = StrUtil.replace(newCommand, StrUtil.LF, StrUtil.SPACE);
//
DefaultSystemLog.getLog().info(newCommand);
List<String> commands = getCommand(); List<String> commands = getCommand();
commands.add(command); commands.add(newCommand);
ProcessBuilder pb = new ProcessBuilder(commands); ProcessBuilder pb = new ProcessBuilder(commands);
if (file != null) { if (file != null) {
pb.directory(file); pb.directory(file);