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
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export function getPtyProcessOptions(
args: [],
cwd: cmd.cwd,
env,
initCommand: cmd.initCommand,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ export function createPtyHostClient(
request.setCwd(ptyOptions.cwd);
}

if (ptyOptions.initCommand) {
request.setInitCommand(ptyOptions.initCommand);
}

return new Promise<string>((resolve, reject) => {
client.createPtyProcess(request, (error, response) => {
if (error) {
Expand Down
1 change: 0 additions & 1 deletion web/packages/teleterm/src/services/pty/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export type PtyServiceClient = {
export type ShellCommand = PtyCommandBase & {
kind: 'pty.shell';
cwd?: string;
initCommand?: string;
};

export type TshLoginCommand = PtyCommandBase & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ message PtyCreate {
string path = 3;
repeated string args = 4;
string cwd = 5;
optional string init_command = 6;
reserved 6;
reserved "init_command";
google.protobuf.Struct env = 7;
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export function createPtyHostService(): IPtyHostServer {
path: ptyOptions.path,
args: ptyOptions.argsList,
cwd: ptyOptions.cwd,
initCommand: ptyOptions.initCommand,
ptyId,
env: call.request.getEnv()?.toJavaScript() as Record<string, string>,
});
Expand Down
4 changes: 0 additions & 4 deletions web/packages/teleterm/src/sharedProcess/ptyHost/ptyProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ export class PtyProcess extends EventEmitter implements IPtyProcess {

this._process.onData(data => this._handleData(data));
this._process.onExit(ev => this._handleExit(ev));

if (this.options.initCommand) {
this._process.write(this.options.initCommand + '\r');
}
}

write(data: string) {
Expand Down
1 change: 0 additions & 1 deletion web/packages/teleterm/src/sharedProcess/ptyHost/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export type PtyProcessOptions = {
path: string;
args: string[];
cwd?: string;
initCommand?: string;
};

export type IPtyProcess = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,24 +251,10 @@ async function setUpPtyProcess(
});
};

const removeInitCommand = () => {
if (doc.kind !== 'doc.terminal_shell') {
return;
}
// The initCommand has to be launched only once, not every time we recreate the document from
// the state.
//
// Imagine that someone creates a new terminal document with `rm -rf /tmp` as initCommand.
// We'd execute the command each time the document gets recreated from the state, which is not
// what the user would expect.
documentsService.update(doc.uri, { initCommand: undefined });
};

// We don't need to clean up the listeners added on ptyProcess in this function. The effect which
// calls setUpPtyProcess automatically disposes of the process on cleanup, removing all listeners.
ptyProcess.onOpen(() => {
refreshTitle();
removeInitCommand();
});

// TODO(ravicious): Refactor runOnce to not use the `n` variable. Otherwise runOnce subtracts 1
Expand Down Expand Up @@ -409,6 +395,5 @@ function createCmd(
proxyHost,
clusterName,
cwd: doc.cwd,
initCommand: doc.initCommand,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
CreateAccessRequestDocumentOpts,
CreateClusterDocumentOpts,
CreateGatewayDocumentOpts,
CreateNewTerminalOpts,
CreateTshKubeDocumentOptions,
Document,
DocumentAccessRequests,
Expand Down Expand Up @@ -182,7 +181,7 @@ export class DocumentsService {
};
}

openNewTerminal(opts: CreateNewTerminalOpts) {
openNewTerminal(opts: { rootClusterId: string; leafClusterId?: string }) {
const doc = ((): Document => {
const activeDocument = this.getActive();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ export interface DocumentAccessRequests extends DocumentBase {
export interface DocumentPtySession extends DocumentBase {
kind: 'doc.terminal_shell';
cwd?: string;
initCommand?: string;
rootClusterId?: string;
leafClusterId?: string;
}
Expand Down Expand Up @@ -211,9 +210,3 @@ export type CreateAccessRequestDocumentOpts = {
};

export type AccessRequestDocumentState = 'browsing' | 'creating' | 'reviewing';

export type CreateNewTerminalOpts = {
initCommand?: string;
rootClusterId: string;
leafClusterId?: string;
};