Skip to content

Commit

Permalink
Address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanburns committed Nov 21, 2024
1 parent f5f6b33 commit d17707d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/web-socket-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,11 @@ export class WebSocketHandler implements WebSocketInterface {
}

public static closeStream(streamNum: number, streams: StreamInterface): void {
console.log('Closing stream: ' + streamNum);
switch (streamNum) {
case WebSocketHandler.StdinStream:
streams.stdin.pause();
break;
case WebSocketHandler.StdoutStream:
console.log('closing stdout');
streams.stdout.end();
break;
case WebSocketHandler.StderrStream:
Expand Down Expand Up @@ -249,7 +247,6 @@ export class WebSocketHandler implements WebSocketInterface {
} else if (data instanceof Buffer) {
const streamNum = data.readUint8(0);
if (streamNum === WebSocketHandler.CloseStream) {
console.log('Closing stream!');
WebSocketHandler.closeStream(data.readInt8(1), this.streams);
}
if (binaryHandler && !binaryHandler(streamNum, data.subarray(1))) {
Expand Down
4 changes: 2 additions & 2 deletions src/web-socket-handler_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { promisify } from 'util';
import { expect } from 'chai';
import WebSocket = require('isomorphic-ws');
import { ReadableStreamBuffer, WritableStreamBuffer } from 'stream-buffers';
import stream = require('stream');
import stream from 'node:stream';

import { V1Status } from './api';
import { KubeConfig } from './config';
Expand Down Expand Up @@ -401,7 +401,7 @@ describe('V5 protocol support', () => {
stdinStream.emit('end');
expect(sent).to.not.be.null;
expect(sent!.readUint8(0)).to.equal(255); // CLOSE signal
expect(sent!.readUInt8(1)).to.equal(0); // Stdin stream is #0
expect(sent!.readUint8(1)).to.equal(0); // Stdin stream is #0
});
});

Expand Down

0 comments on commit d17707d

Please sign in to comment.