mc command delegate additional output from the compiler. #662

This commit is contained in:
hengyunabc
2019-04-23 21:04:04 +08:00
parent 0938b3ccfa
commit 232a3f56b4
2 changed files with 27 additions and 3 deletions
@@ -1,6 +1,8 @@
package com.taobao.arthas.core.command.klass100;
import java.io.File;
import java.io.IOException;
import java.io.Writer;
import java.lang.instrument.Instrumentation;
import java.nio.charset.Charset;
import java.util.List;
@@ -69,7 +71,7 @@ public class MemoryCompilerCommand extends AnnotatedCommand {
}
@Override
public void process(CommandProcess process) {
public void process(final CommandProcess process) {
int exitCode = 0;
RowAffect affect = new RowAffect();
@@ -87,7 +89,22 @@ public class MemoryCompilerCommand extends AnnotatedCommand {
}
}
DynamicCompiler dynamicCompiler = new DynamicCompiler(classloader);
DynamicCompiler dynamicCompiler = new DynamicCompiler(classloader, new Writer() {
@Override
public void write(char[] cbuf, int off, int len) throws IOException {
process.write(new String(cbuf, off, len));
}
@Override
public void flush() throws IOException {
}
@Override
public void close() throws IOException {
}
});
Charset charset = Charset.defaultCharset();
if (encoding != null) {