Skip to content

Commit

Permalink
remove a layer of indirection
Browse files Browse the repository at this point in the history
  • Loading branch information
jackyzha0 committed Oct 24, 2024
1 parent 272d0a1 commit e3446de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ describe(
);

test('doesnt miss large output from fast commands',
{ repeats: 10 },
{ repeats: 50 },
() =>
new Promise<void>((done) => {
const payload = `hello`.repeat(4096);
Expand Down
13 changes: 6 additions & 7 deletions wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ export class Pty {
this.#fd = this.#pty.takeFd();

this.#socket = new ReadStream(this.#fd);
const userFacingRead = new PassThrough();
const userFacingWrite = new PassThrough();
this.#socket.pipe(userFacingRead);
userFacingWrite.pipe(this.#socket);
this.read = userFacingRead;
this.write = userFacingWrite;
// const userFacingRead = new PassThrough();
// const userFacingWrite = new PassThrough();
// this.#socket.pipe(userFacingRead);
// userFacingWrite.pipe(this.#socket);
this.read = this.#socket;
this.write = this.#socket;

// catch end events
const handleClose = () => {
Expand All @@ -88,7 +88,6 @@ export class Pty {
exitResult.then((result) => {
realExit(result.error, result.code)
});
userFacingRead.end();
};
this.#socket.on('close', handleClose);

Expand Down

0 comments on commit e3446de

Please sign in to comment.