-
Notifications
You must be signed in to change notification settings - Fork 665
Open
Description
runWorkspaceCommandAsync used in two places:
rushstack/vscode-extensions/debug-certificate-manager-vscode-extension/src/extension.ts
Lines 210 to 226 in 98334a9
| const markerPrefix: string = '<<<HOMEDIR_START>>>'; | |
| const markerSuffix: string = '<<<HOMEDIR_END>>>'; | |
| const output: string = await runWorkspaceCommandAsync({ | |
| terminalOptions: { name: 'debug-certificate-manager', hideFromUser: true }, | |
| // Wrapping the desired node output in markers to trim uninteresting shell output. | |
| commandLine: `node -p "'${markerPrefix}' + require('os').homedir() + '${markerSuffix}'"`, | |
| terminal | |
| }); | |
| terminal.writeLine(`Running command to resolve home directory: ${output}`); | |
| const startIndex: number = output.lastIndexOf(markerPrefix); | |
| const endIndex: number = output.lastIndexOf(markerSuffix); | |
| if (startIndex !== -1 && endIndex !== -1 && endIndex > startIndex) { | |
| homeDir = output.substring(startIndex + markerPrefix.length, endIndex).trim(); | |
| } else { | |
| throw new Error('Failed to parse home directory from command output'); | |
| } |
and
rushstack/vscode-extensions/playwright-local-browser-server-vscode-extension/src/extension.ts
Lines 48 to 62 in 98334a9
| const markerPrefix: string = '<<<TEMPDIR_START>>>'; | |
| const markerSuffix: string = '<<<TEMPDIR_END>>>'; | |
| const output: string = await runWorkspaceCommandAsync({ | |
| terminalOptions: { name: 'playwright-local-browser-server', hideFromUser: true }, | |
| commandLine: `node -p "'${markerPrefix}' + require('node:os').tmpdir() + '${markerSuffix}'"`, | |
| terminal | |
| }); | |
| const startIndex: number = output.indexOf(markerPrefix); | |
| const endIndex: number = output.indexOf(markerSuffix); | |
| if (startIndex !== -1 && endIndex !== -1 && endIndex > startIndex) { | |
| tempDir = output.substring(startIndex + markerPrefix.length, endIndex).trim(); | |
| } else { | |
| throw new Error('Failed to parse temp directory from command output'); | |
| } |
with duplicate string marker logic wrapped around the usage of these functions.
We should abstract this as a new option in runWorkspaceCommandAsync so we don't have this extra logic.
Copilot
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Needs triage