Skip to content

Commit b718b4f

Browse files
committed
node update testing
1 parent 1ae4270 commit b718b4f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/client/common/process/logger.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ export class ProcessLogger implements IProcessLogger {
2727
let command = args
2828
? [fileOrCommand, ...args].map((e) => e.trimQuotes().toCommandArgumentForPythonExt()).join(' ')
2929
: fileOrCommand;
30-
const info = [`> ${this.getDisplayCommands(command)}`];
30+
const info = [`> ${this.getDisplayCommands(command, false)}`];
3131
if (options?.cwd) {
3232
const cwd: string = typeof options?.cwd === 'string' ? options?.cwd : options?.cwd?.toString();
33-
info.push(`cwd: ${this.getDisplayCommands(cwd)}`);
33+
info.push(`cwd: ${this.getDisplayCommands(cwd, true)}`);
3434
}
3535
if (typeof options?.shell === 'string') {
3636
info.push(`shell: ${identifyShellFromShellPath(options?.shell)}`);
@@ -41,9 +41,16 @@ export class ProcessLogger implements IProcessLogger {
4141
});
4242
}
4343

44-
private getDisplayCommands(command: string): string {
44+
private getDisplayCommands(command: string, isCwd: boolean = false): string {
4545
if (this.workspaceService.workspaceFolders && this.workspaceService.workspaceFolders.length === 1) {
46-
command = replaceMatchesWithCharacter(command, this.workspaceService.workspaceFolders[0].uri.fsPath, '.');
46+
const workspacePath = this.workspaceService.workspaceFolders[0].uri.fsPath;
47+
if (isCwd) {
48+
// For working directory paths, replace workspace path with '.'
49+
command = replaceMatchesWithCharacter(command, workspacePath, '.');
50+
} else if (command.includes(workspacePath)) {
51+
// For command paths, make them relative to workspace by replacing workspace path with './'
52+
command = command.replace(workspacePath, '.');
53+
}
4754
}
4855
const home = getUserHomeDir();
4956
if (home) {

0 commit comments

Comments
 (0)