Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface ITerminal {
* Writes data to the socket.
* @param data The data to write.
*/
write(data: string): void;
write(data: string | Buffer): void;

/**
* Resize the pty.
Expand Down
2 changes: 1 addition & 1 deletion src/terminal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TestTerminal extends Terminal {
public checkType<T>(name: string, value: T, type: string, allowArray: boolean = false): void {
this._checkType(name, value, type, allowArray);
}
protected _write(data: string): void {
protected _write(data: string | Buffer): void {
throw new Error('Method not implemented.');
}
public resize(cols: number, rows: number): void {
Expand Down
4 changes: 2 additions & 2 deletions src/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ export abstract class Terminal implements ITerminal {
this._checkType('encoding', opt.encoding ? opt.encoding : undefined, 'string');
}

protected abstract _write(data: string): void;
protected abstract _write(data: string | Buffer): void;

public write(data: string): void {
public write(data: string | Buffer): void {
if (this.handleFlowControl) {
// PAUSE/RESUME messages are not forwarded to the pty
if (data === this._flowControlPause) {
Expand Down
2 changes: 1 addition & 1 deletion src/unixTerminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export class UnixTerminal extends Terminal {
this._forwardEvents();
}

protected _write(data: string): void {
protected _write(data: string | Buffer): void {
this._socket.write(data);
}

Expand Down
4 changes: 2 additions & 2 deletions src/windowsTerminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ export class WindowsTerminal extends Terminal {
this._forwardEvents();
}

protected _write(data: string): void {
protected _write(data: string | Buffer): void {
this._defer(this._doWrite, data);
}

private _doWrite(data: string): void {
private _doWrite(data: string | Buffer): void {
this._agent.inSocket.write(data);
}

Expand Down
2 changes: 1 addition & 1 deletion typings/node-pty.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ declare module 'node-pty' {
* Writes data to the pty.
* @param data The data to write.
*/
write(data: string): void;
write(data: string | Buffer): void;

/**
* Kills the pty.
Expand Down