Skip to content

Commit ea7ac6e

Browse files
committed
Override connect timeout
`parsed` is not used anywhere so I deleted it.
1 parent d775e37 commit ea7ac6e

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/remote.ts

+17-4
Original file line numberDiff line numberDiff line change
@@ -273,17 +273,30 @@ export class Remote {
273273
[`${authorityParts[1]}`]: agent.operating_system,
274274
}
275275

276+
// VS Code ignores the connect timeout in the SSH config and uses a default
277+
// of 15 seconds, which can be too short in the case where we wait for
278+
// startup scripts. For now we hardcode a longer value.
279+
const connectTimeout = 1800
280+
276281
let settingsContent = "{}"
277282
try {
278283
settingsContent = await fs.readFile(this.storage.getUserSettingsPath(), "utf8")
279284
} catch (ex) {
280285
// Ignore! It's probably because the file doesn't exist.
281286
}
282-
const parsed = jsonc.parse(settingsContent)
283-
parsed["remote.SSH.remotePlatform"] = remotePlatforms
284-
const edits = jsonc.modify(settingsContent, ["remote.SSH.remotePlatform"], remotePlatforms, {})
287+
288+
settingsContent = jsonc.applyEdits(
289+
settingsContent,
290+
jsonc.modify(settingsContent, ["remote.SSH.remotePlatform"], remotePlatforms, {}),
291+
)
292+
293+
settingsContent = jsonc.applyEdits(
294+
settingsContent,
295+
jsonc.modify(settingsContent, ["remote.SSH.connectTimeout"], connectTimeout, {}),
296+
)
297+
285298
try {
286-
await fs.writeFile(this.storage.getUserSettingsPath(), jsonc.applyEdits(settingsContent, edits))
299+
await fs.writeFile(this.storage.getUserSettingsPath(), settingsContent)
287300
} catch (ex) {
288301
// The user will just be prompted instead, which is fine!
289302
// If a user's settings.json is read-only, then we can't write to it.

0 commit comments

Comments
 (0)