more graceful handle stdout
This commit is contained in:
parent
6edec2094f
commit
4fc40aa928
|
@ -39,10 +39,8 @@ export class Port extends Duplex {
|
|||
const term = this.bert.encode(obj, true);
|
||||
const len = Buffer.alloc(4);
|
||||
len.writeUInt32BE(term.length, 0);
|
||||
process.stdout.write = this.originalStdout;
|
||||
process.stdout.write(len);
|
||||
process.stdout.write(term, actualCallback);
|
||||
process.stdout.write = this.fakeStdout;
|
||||
this.originalStdout.write(len);
|
||||
this.originalStdout.write(term, actualCallback);
|
||||
return true;
|
||||
}
|
||||
catch (error) {
|
||||
|
|
|
@ -51,10 +51,8 @@ export class Port extends Duplex {
|
|||
const len = Buffer.alloc(4);
|
||||
len.writeUInt32BE(term.length, 0);
|
||||
|
||||
process.stdout.write = this.originalStdout as any;
|
||||
process.stdout.write(len);
|
||||
process.stdout.write(term, actualCallback);
|
||||
process.stdout.write = this.fakeStdout;
|
||||
this.originalStdout.write(len);
|
||||
this.originalStdout.write(term, actualCallback);
|
||||
return true;
|
||||
}
|
||||
catch (error) {
|
||||
|
|
Loading…
Reference in New Issue