mirror of
https://gitee.com/BDWare/cm
synced 2025-01-10 09:54:03 +00:00
feat: enable ContractPrinter by isDebug
This commit is contained in:
parent
3db9180ceb
commit
540fbd65f8
@ -22,6 +22,7 @@ import org.bdware.sc.util.JsonUtil;
|
|||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -285,7 +286,8 @@ public class ContractClient {
|
|||||||
PrintStream printStream = new PrintStream(process.getOutputStream());
|
PrintStream printStream = new PrintStream(process.getOutputStream());
|
||||||
printStream.println("CP PID:" + pid);
|
printStream.println("CP PID:" + pid);
|
||||||
printStream.close();
|
printStream.close();
|
||||||
Scanner sc = new Scanner(process.getInputStream());
|
InputStream processInputStream = process.getInputStream();
|
||||||
|
Scanner sc = new Scanner(processInputStream);
|
||||||
String status = null;
|
String status = null;
|
||||||
while (sc.hasNext()) {
|
while (sc.hasNext()) {
|
||||||
status = sc.nextLine();
|
status = sc.nextLine();
|
||||||
@ -315,10 +317,16 @@ public class ContractClient {
|
|||||||
ContractManager.cPort.updateDb(port, true);
|
ContractManager.cPort.updateDb(port, true);
|
||||||
get = new SocketGet("127.0.0.1", port);
|
get = new SocketGet("127.0.0.1", port);
|
||||||
get.syncGet("", "setDBInfo", ContractManager.dbPath);
|
get.syncGet("", "setDBInfo", ContractManager.dbPath);
|
||||||
String tagA = (ps == System.out ? "[Contract_" + port + "_out] " : "");
|
if (isDebug) {
|
||||||
String tagB = (ps == System.out ? "[Contract_" + port + "_err] " : "");
|
String tagA = (ps == System.out ? "[Contract_" + port + "_out] " : "");
|
||||||
outputTracer.track(process, sc, tagA, ps);
|
String tagB = (ps == System.out ? "[Contract_" + port + "_err] " : "");
|
||||||
errorTracer.track(process, new Scanner(process.getErrorStream()), tagB, ps);
|
outputTracer.track(process, sc, tagA, ps);
|
||||||
|
errorTracer.track(process, new Scanner(process.getErrorStream()), tagB, ps);
|
||||||
|
} else {
|
||||||
|
// 关闭流,否则缓冲区打满会阻塞进程
|
||||||
|
processInputStream.close();
|
||||||
|
sc.close();
|
||||||
|
}
|
||||||
get.syncGet("", "registerMangerPort", String.valueOf(ContractManager.cPort.getCMPort()));
|
get.syncGet("", "registerMangerPort", String.valueOf(ContractManager.cPort.getCMPort()));
|
||||||
|
|
||||||
if (isBundlePath(contractMeta.contract.getScriptStr())) {
|
if (isBundlePath(contractMeta.contract.getScriptStr())) {
|
||||||
|
Loading…
Reference in New Issue
Block a user