File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed
Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import { getHeaderArgs } from "./headers";
1616import { getProxyForUrl } from "./proxy" ;
1717import { Storage } from "./storage" ;
1818import { expandPath } from "./util" ;
19+ import { FeatureSet } from "./featureSet" ;
1920
2021export const coderSessionTokenHeader = "Coder-Session-Token" ;
2122
@@ -174,6 +175,7 @@ export async function startWorkspaceIfStoppedOrFailed(
174175 binPath : string ,
175176 workspace : Workspace ,
176177 writeEmitter : vscode . EventEmitter < string > ,
178+ featureSet : FeatureSet
177179) : Promise < Workspace > {
178180 // Before we start a workspace, we make an initial request to check it's not already started
179181 const updatedWorkspace = await restClient . getWorkspace ( workspace . id ) ;
@@ -189,10 +191,12 @@ export async function startWorkspaceIfStoppedOrFailed(
189191 ...getHeaderArgs ( vscode . workspace . getConfiguration ( ) ) ,
190192 "start" ,
191193 "--yes" ,
192- workspace . owner_name + "/" + workspace . name ,
193- "--reason" ,
194- "vscode_connection" ,
194+ workspace . owner_name + "/" + workspace . name
195195 ] ;
196+ if ( featureSet . buildReason ) {
197+ startArgs . push ( ...[ '--reason' , 'vscode_connection' ] )
198+ }
199+
196200 const startProcess = spawn ( binPath , startArgs ) ;
197201
198202 startProcess . stdout . on ( "data" , ( data : Buffer ) => {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ export type FeatureSet = {
44 vscodessh : boolean ;
55 proxyLogDirectory : boolean ;
66 wildcardSSH : boolean ;
7+ buildReason : boolean ;
78} ;
89
910/**
@@ -29,5 +30,10 @@ export function featureSetForVersion(
2930 wildcardSSH :
3031 ( version ? version . compare ( "2.19.0" ) : - 1 ) >= 0 ||
3132 version ?. prerelease [ 0 ] === "devel" ,
33+
34+ // --reason flag was added in 2.25.0
35+ buildReason :
36+ ( version ?. compare ( "2.25.0" ) || 0 ) >= 0 ||
37+ version ?. prerelease [ 0 ] === "devel" ,
3238 } ;
3339}
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ export class Remote {
6868 workspace : Workspace ,
6969 label : string ,
7070 binPath : string ,
71+ featureSet : FeatureSet
7172 ) : Promise < Workspace | undefined > {
7273 const workspaceName = `${ workspace . owner_name } /${ workspace . name } ` ;
7374
@@ -140,6 +141,7 @@ export class Remote {
140141 binPath ,
141142 workspace ,
142143 writeEmitter ,
144+ featureSet
143145 ) ;
144146 break ;
145147 case "failed" :
@@ -159,6 +161,7 @@ export class Remote {
159161 binPath ,
160162 workspace ,
161163 writeEmitter ,
164+ featureSet
162165 ) ;
163166 break ;
164167 }
@@ -393,6 +396,7 @@ export class Remote {
393396 workspace ,
394397 parts . label ,
395398 binaryPath ,
399+ featureSet
396400 ) ;
397401 if ( ! updatedWorkspace ) {
398402 // User declined to start the workspace.
You can’t perform that action at this time.
0 commit comments