diff --git a/src/api.ts b/src/api.ts index 22de2618..063b7ae2 100644 --- a/src/api.ts +++ b/src/api.ts @@ -12,6 +12,7 @@ import * as vscode from "vscode"; import * as ws from "ws"; import { errToStr } from "./api-helper"; import { CertificateError } from "./error"; +import { FeatureSet } from "./featureSet"; import { getHeaderArgs } from "./headers"; import { getProxyForUrl } from "./proxy"; import { Storage } from "./storage"; @@ -174,6 +175,7 @@ export async function startWorkspaceIfStoppedOrFailed( binPath: string, workspace: Workspace, writeEmitter: vscode.EventEmitter, + featureSet: FeatureSet, ): Promise { // Before we start a workspace, we make an initial request to check it's not already started const updatedWorkspace = await restClient.getWorkspace(workspace.id); @@ -191,6 +193,10 @@ export async function startWorkspaceIfStoppedOrFailed( "--yes", workspace.owner_name + "/" + workspace.name, ]; + if (featureSet.buildReason) { + startArgs.push(...["--reason", "vscode_connection"]); + } + const startProcess = spawn(binPath, startArgs); startProcess.stdout.on("data", (data: Buffer) => { diff --git a/src/featureSet.ts b/src/featureSet.ts index 958aeae5..67121229 100644 --- a/src/featureSet.ts +++ b/src/featureSet.ts @@ -4,6 +4,7 @@ export type FeatureSet = { vscodessh: boolean; proxyLogDirectory: boolean; wildcardSSH: boolean; + buildReason: boolean; }; /** @@ -29,5 +30,10 @@ export function featureSetForVersion( wildcardSSH: (version ? version.compare("2.19.0") : -1) >= 0 || version?.prerelease[0] === "devel", + + // The --reason flag was added to `coder start` in 2.25.0 + buildReason: + (version?.compare("2.25.0") || 0) >= 0 || + version?.prerelease[0] === "devel", }; } diff --git a/src/remote.ts b/src/remote.ts index 4a13ae56..59f04562 100644 --- a/src/remote.ts +++ b/src/remote.ts @@ -68,6 +68,7 @@ export class Remote { workspace: Workspace, label: string, binPath: string, + featureSet: FeatureSet, ): Promise { const workspaceName = `${workspace.owner_name}/${workspace.name}`; @@ -140,6 +141,7 @@ export class Remote { binPath, workspace, writeEmitter, + featureSet, ); break; case "failed": @@ -159,6 +161,7 @@ export class Remote { binPath, workspace, writeEmitter, + featureSet, ); break; } @@ -393,6 +396,7 @@ export class Remote { workspace, parts.label, binaryPath, + featureSet, ); if (!updatedWorkspace) { // User declined to start the workspace. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy