This commit is contained in:
CaiHQ 2022-06-10 16:12:55 +08:00
commit 2f874832b8

View File

@ -22,6 +22,7 @@ import org.bdware.sc.util.JsonUtil;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.InputStream;
import java.io.PrintStream;
import java.lang.reflect.Field;
import java.util.*;
@ -285,7 +286,8 @@ public class ContractClient {
PrintStream printStream = new PrintStream(process.getOutputStream());
printStream.println("CP PID:" + pid);
printStream.close();
Scanner sc = new Scanner(process.getInputStream());
InputStream processInputStream = process.getInputStream();
Scanner sc = new Scanner(processInputStream);
String status = null;
while (sc.hasNext()) {
status = sc.nextLine();
@ -315,18 +317,18 @@ public class ContractClient {
ContractManager.cPort.updateDb(port, true);
get = new SocketGet("127.0.0.1", port);
get.syncGet("", "setDBInfo", ContractManager.dbPath);
String tagA = (ps == System.out ? "[Contract_" + port + "_out] " : "");
String tagB = (ps == System.out ? "[Contract_" + port + "_err] " : "");
if (isDebug) {
LOGGER.debug("start as Debug, track err/out");
String tagA = (ps == System.out ? "[Contract_" + port + "_out] " : "");
String tagB = (ps == System.out ? "[Contract_" + port + "_err] " : "");
outputTracer.track(process, sc, tagA, ps);
errorTracer.track(process, new Scanner(process.getErrorStream()), tagB, ps);
} else {
LOGGER.debug("start, do not track err/out");
// 关闭流否则缓冲区打满会阻塞进程
processInputStream.close();
sc.close();
}
get.syncGet("", "registerMangerPort", String.valueOf(ContractManager.cPort.getCMPort()));
if (isBundlePath(contractMeta.contract.getScriptStr())) {
status =
get.syncGet(