Skip to content

Commit ecc3f57

Browse files
committed
Fix setting the default flags
1 parent 0a1e51f commit ecc3f57

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/cliConfig.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ export function getGlobalFlags(
2424
* Returns SSH flags for the `coder ssh` command from user configuration.
2525
*/
2626
export function getSshFlags(configs: WorkspaceConfiguration): string[] {
27-
return configs.get<string[]>("coder.sshFlags") || [];
27+
// Make sure to match this default with the one in the package.json
28+
return configs.get<string[]>("coder.sshFlags", ["--disable-autostart"]);
2829
}

src/remote/remote.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ export class Remote {
596596
if (useWildcardSSH) {
597597
// User SSH flags are included first; internally-managed flags
598598
// are appended last so they take precedence.
599-
const userSSHFlags = getSshFlags(vscodeConfig);
599+
const userSshFlags = getSshFlags(vscodeConfig);
600600
// Make sure to update the `coder.sshFlags` description if we add more internal flags here!
601601
const internalFlags = [
602602
"--stdio",
@@ -609,7 +609,7 @@ export class Remote {
609609
"%h",
610610
];
611611

612-
const allFlags = [...userSSHFlags, ...internalFlags];
612+
const allFlags = [...userSshFlags, ...internalFlags];
613613
return `${escapedBinaryPath} ${globalConfig.join(" ")} ssh ${allFlags.join(" ")}`;
614614
} else {
615615
const networkInfoDir = escapeCommandArg(

test/unit/cliConfig.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ describe("cliConfig", () => {
8383
});
8484

8585
describe("getSshFlags", () => {
86-
it("returns empty array when no SSH flags configured", () => {
86+
it("returns default flags when no SSH flags configured", () => {
8787
const config = {
88-
get: () => undefined,
88+
get: (_key: string, defaultValue: unknown) => defaultValue,
8989
} as unknown as WorkspaceConfiguration;
9090

91-
expect(getSshFlags(config)).toStrictEqual([]);
91+
expect(getSshFlags(config)).toStrictEqual(["--disable-autostart"]);
9292
});
9393

9494
it("returns SSH flags from config", () => {

0 commit comments

Comments
 (0)