New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create pty host starter interface and move pty host to main process #178708
Merged
Merged
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
a9fbd36
Start extracting pty host starter into interface
Tyriar 7ede808
Return exit event
Tyriar 39041c6
Support utility process in ptyHostMain.ts
Tyriar 86b75c2
Support dispose, move shared interfaces
Tyriar d600b2e
Move pty host from shared to main proc
Tyriar f33f29a
Start ElectronPtyHostStarter impl
Tyriar b76b7d2
Fix import issue
Tyriar 7f4221a
Merge remote-tracking branch 'origin/main' into tyriar/utility_ptyhost
Tyriar 3214d06
Fix compile after merge
Tyriar 0a4d4e2
Make electron pty host starter always return node impl for now
Tyriar 57d5861
Clean up
Tyriar a3c7981
Fix logging not showing up on first window
Tyriar 761cd41
Clean up, fix compile
Tyriar 2605017
Remove unused remote env var
Tyriar 1de9210
Merge remote-tracking branch 'origin/main' into tyriar/utility_ptyhost
Tyriar File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/vs/platform/terminal/electron-main/electronPtyHostStarter.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; | ||
import { IReconnectConstants } from 'vs/platform/terminal/common/terminal'; | ||
import { NodePtyHostStarter } from 'vs/platform/terminal/node/nodePtyHostStarter'; | ||
import { IPtyHostConnection, IPtyHostStarter } from 'vs/platform/terminal/node/ptyHost'; | ||
// import { FileAccess } from 'vs/base/common/network'; | ||
// import { Client, IIPCOptions } from 'vs/base/parts/ipc/node/ipc.cp'; | ||
// import { parsePtyHostDebugPort } from 'vs/platform/environment/node/environmentService'; | ||
// import { UtilityProcess } from 'vs/platform/utilityProcess/electron-main/utilityProcess'; | ||
|
||
export class ElectronPtyHostStarter implements IPtyHostStarter { | ||
|
||
// private utilityProcess: UtilityProcess | undefined = undefined; | ||
|
||
constructor( | ||
private readonly _reconnectConstants: IReconnectConstants, | ||
private readonly _isRemote: boolean, | ||
@IEnvironmentService private readonly _environmentService: INativeEnvironmentService | ||
) { | ||
} | ||
|
||
start(lastPtyId: number): IPtyHostConnection { | ||
return new NodePtyHostStarter(this._reconnectConstants, this._isRemote, this._environmentService).start(lastPtyId); | ||
|
||
// console.log('use utility proc'); | ||
|
||
// // TODO: Convert to use utility process | ||
// const opts: IIPCOptions = { | ||
// serverName: 'Pty Host', | ||
// args: ['--type=ptyHost', '--logsPath', this._environmentService.logsHome.fsPath], | ||
// env: { | ||
// VSCODE_LAST_PTY_ID: lastPtyId, | ||
// VSCODE_PTY_REMOTE: this._isRemote, | ||
// VSCODE_AMD_ENTRYPOINT: 'vs/platform/terminal/node/ptyHostMain', | ||
// VSCODE_PIPE_LOGGING: 'true', | ||
// VSCODE_VERBOSE_LOGGING: 'true', // transmit console logs from server to client, | ||
// VSCODE_RECONNECT_GRACE_TIME: this._reconnectConstants.graceTime, | ||
// VSCODE_RECONNECT_SHORT_GRACE_TIME: this._reconnectConstants.shortGraceTime, | ||
// VSCODE_RECONNECT_SCROLLBACK: this._reconnectConstants.scrollback | ||
// } | ||
// }; | ||
|
||
// const ptyHostDebug = parsePtyHostDebugPort(this._environmentService.args, this._environmentService.isBuilt); | ||
// if (ptyHostDebug) { | ||
// if (ptyHostDebug.break && ptyHostDebug.port) { | ||
// opts.debugBrk = ptyHostDebug.port; | ||
// } else if (!ptyHostDebug.break && ptyHostDebug.port) { | ||
// opts.debug = ptyHostDebug.port; | ||
// } | ||
// } | ||
|
||
// const client = new Client(FileAccess.asFileUri('bootstrap-fork').fsPath, opts); | ||
|
||
// return { | ||
// client, | ||
// dispose: client.dispose, | ||
// onDidProcessExit: client.onDidProcessExit | ||
// }; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { FileAccess } from 'vs/base/common/network'; | ||
import { Client, IIPCOptions } from 'vs/base/parts/ipc/node/ipc.cp'; | ||
import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; | ||
import { parsePtyHostDebugPort } from 'vs/platform/environment/node/environmentService'; | ||
import { IReconnectConstants } from 'vs/platform/terminal/common/terminal'; | ||
import { IPtyHostConnection, IPtyHostStarter } from 'vs/platform/terminal/node/ptyHost'; | ||
|
||
export class NodePtyHostStarter implements IPtyHostStarter { | ||
constructor( | ||
private readonly _reconnectConstants: IReconnectConstants, | ||
private readonly _isRemote: boolean, | ||
@IEnvironmentService private readonly _environmentService: INativeEnvironmentService | ||
) { | ||
} | ||
|
||
start(lastPtyId: number): IPtyHostConnection { | ||
const opts: IIPCOptions = { | ||
serverName: 'Pty Host', | ||
args: ['--type=ptyHost', '--logsPath', this._environmentService.logsHome.fsPath], | ||
env: { | ||
VSCODE_LAST_PTY_ID: lastPtyId, | ||
VSCODE_PTY_REMOTE: this._isRemote, | ||
VSCODE_AMD_ENTRYPOINT: 'vs/platform/terminal/node/ptyHostMain', | ||
VSCODE_PIPE_LOGGING: 'true', | ||
VSCODE_VERBOSE_LOGGING: 'true', // transmit console logs from server to client, | ||
VSCODE_RECONNECT_GRACE_TIME: this._reconnectConstants.graceTime, | ||
VSCODE_RECONNECT_SHORT_GRACE_TIME: this._reconnectConstants.shortGraceTime, | ||
VSCODE_RECONNECT_SCROLLBACK: this._reconnectConstants.scrollback | ||
} | ||
}; | ||
|
||
const ptyHostDebug = parsePtyHostDebugPort(this._environmentService.args, this._environmentService.isBuilt); | ||
if (ptyHostDebug) { | ||
if (ptyHostDebug.break && ptyHostDebug.port) { | ||
opts.debugBrk = ptyHostDebug.port; | ||
} else if (!ptyHostDebug.break && ptyHostDebug.port) { | ||
opts.debug = ptyHostDebug.port; | ||
} | ||
} | ||
|
||
const client = new Client(FileAccess.asFileUri('bootstrap-fork').fsPath, opts); | ||
|
||
return { | ||
client, | ||
dispose: client.dispose, | ||
onDidProcessExit: client.onDidProcessExit | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { Event } from 'vs/base/common/event'; | ||
import { IDisposable } from 'vs/base/common/lifecycle'; | ||
import { IChannelClient } from 'vs/base/parts/ipc/common/ipc'; | ||
|
||
export interface IPtyHostConnection extends IDisposable { | ||
readonly client: IChannelClient; | ||
readonly onDidProcessExit: Event<{ code: number; signal: string }>; | ||
} | ||
|
||
export interface IPtyHostStarter { | ||
/** | ||
* Creates a pty host and connects to it. | ||
* | ||
* @param lastPtyId Tracks the last terminal ID from the pty host so we can give it to the new | ||
* pty host if it's restarted and avoid ID conflicts. | ||
*/ | ||
start(lastPtyId: number): IPtyHostConnection; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented out code