This commit is contained in:
bwcx_jzy 2024-01-17 18:44:37 +08:00
parent e76ae13a00
commit 9975b47e41
No known key found for this signature in database
GPG Key ID: E187D6E9DDDE8C53

View File

@ -2,6 +2,7 @@ package org.dromara.jpom.util;
import cn.hutool.core.map.SafeConcurrentHashMap; import cn.hutool.core.map.SafeConcurrentHashMap;
import cn.hutool.core.util.CharsetUtil; import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.exec.*; import org.apache.commons.exec.*;
import org.apache.commons.exec.environment.EnvironmentUtils; import org.apache.commons.exec.environment.EnvironmentUtils;
@ -10,6 +11,7 @@ import org.dromara.jpom.system.ExtConfigBean;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -47,9 +49,10 @@ public class ApacheExecUtil {
* @throws IOException io * @throws IOException io
*/ */
public static int exec(String execId, File scriptFile, File baseDir, Map<String, String> env, String args, LogRecorder logRecorder) throws IOException { public static int exec(String execId, File scriptFile, File baseDir, Map<String, String> env, String args, LogRecorder logRecorder) throws IOException {
CommandLine commandLine = new CommandLine(scriptFile); List<String> build = CommandUtil.build(scriptFile, args);
commandLine.addArgument(args); String join = String.join(StrUtil.SLASH, build);
log.debug(commandLine.toString()); CommandLine commandLine = CommandLine.parse(join);
log.debug(join);
Charset charset; Charset charset;
try { try {
charset = ExtConfigBean.getConsoleLogCharset(); charset = ExtConfigBean.getConsoleLogCharset();