Skip to content

Commit 8e09243

Browse files
author
Kartik Raj
authored
Correctly set failed property when sending telemetry for TERMINAL_SHELL_IDENTIFICATION (#17832)
1 parent f0ad996 commit 8e09243

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

src/client/common/terminal/shellDetector.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export class ShellDetector {
5757
`${detector}. Shell identified as ${shell} ${terminal ? `(Terminal name is ${terminal.name})` : ''}`,
5858
);
5959
if (shell && shell !== TerminalShellType.other) {
60+
telemetryProperties.failed = false;
6061
break;
6162
}
6263
}

src/client/common/terminal/shellDetectors/vscEnvironmentShellDetector.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export class VSCEnvironmentShellDetector extends BaseShellDetector {
3636
traceVerbose(`Terminal shell path '${shellPath}' identified as shell '${shell}'`);
3737
telemetryProperties.shellIdentificationSource =
3838
shell === TerminalShellType.other ? telemetryProperties.shellIdentificationSource : 'vscode';
39+
telemetryProperties.failed = shell === TerminalShellType.other ? false : true;
3940
return shell;
4041
}
4142
}

src/test/common/terminals/shellDetectors/shellDetectors.unit.test.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,16 @@ suite('Shell Detectors', () => {
5151
shellPathsAndIdentification.set('/usr/bin/xonsh', TerminalShellType.xonsh);
5252
shellPathsAndIdentification.set('/usr/bin/xonshx', TerminalShellType.other);
5353

54-
const telemetryProperties: ShellIdentificationTelemetry = {
55-
failed: true,
56-
shellIdentificationSource: 'default',
57-
terminalProvided: false,
58-
hasCustomShell: undefined,
59-
hasShellInEnv: undefined,
60-
};
54+
let telemetryProperties: ShellIdentificationTelemetry;
6155

6256
setup(() => {
57+
telemetryProperties = {
58+
failed: true,
59+
shellIdentificationSource: 'default',
60+
terminalProvided: false,
61+
hasCustomShell: undefined,
62+
hasShellInEnv: undefined,
63+
};
6364
platformService = mock(PlatformService);
6465
workspaceService = mock(WorkspaceService);
6566
currentProcess = mock(CurrentProcess);
@@ -122,6 +123,7 @@ suite('Shell Detectors', () => {
122123
undefined,
123124
'Should be undefined when vscode.env.shell is undefined',
124125
);
126+
expect(telemetryProperties.failed).to.equal(false);
125127
});
126128
test('Identify shell based on VSC Settings', async () => {
127129
const shellDetector = new SettingsShellDetector(instance(workspaceService), instance(platformService));

0 commit comments

Comments
 (0)