Skip to content

Commit

Permalink
fix(jsii-runtime): Use buffer factory methods instead of constructor. (
Browse files Browse the repository at this point in the history
  • Loading branch information
costleya authored and Elad Ben-Israel committed Sep 26, 2018
1 parent 828a26f commit 6ad6b9d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/jsii-runtime/lib/sync-stdio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ const INPUT_BUFFER_SIZE = 1024 * 1024; // not related to max line length

export class SyncStdio {
private inputQueue = new Array<string>();
private currentLine = ''
private currentLine = '';

writeErrorLine(line: string) {
this.writeBuffer(new Buffer(`${line}\n`), STDERR_FD);
this.writeBuffer(Buffer.from(`${line}\n`), STDERR_FD);
}

writeLine(line: string) {
this.writeBuffer(new Buffer(`${line}\n`), STDOUT_FD);
this.writeBuffer(Buffer.from(`${line}\n`), STDOUT_FD);
}

readLine(): string | undefined {
if (this.inputQueue.length > 0) {
return this.inputQueue.shift();
}

const buff = new Buffer(INPUT_BUFFER_SIZE);
const buff = Buffer.alloc(INPUT_BUFFER_SIZE);
const read = fs.readSync(STDIN_FD, buff, 0, buff.length, null);

if (read === 0) {
Expand Down

0 comments on commit 6ad6b9d

Please sign in to comment.