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";
16
16
import { getProxyForUrl } from "./proxy" ;
17
17
import { Storage } from "./storage" ;
18
18
import { expandPath } from "./util" ;
19
+ import { FeatureSet } from "./featureSet" ;
19
20
20
21
export const coderSessionTokenHeader = "Coder-Session-Token" ;
21
22
@@ -174,6 +175,7 @@ export async function startWorkspaceIfStoppedOrFailed(
174
175
binPath : string ,
175
176
workspace : Workspace ,
176
177
writeEmitter : vscode . EventEmitter < string > ,
178
+ featureSet : FeatureSet
177
179
) : Promise < Workspace > {
178
180
// Before we start a workspace, we make an initial request to check it's not already started
179
181
const updatedWorkspace = await restClient . getWorkspace ( workspace . id ) ;
@@ -189,10 +191,12 @@ export async function startWorkspaceIfStoppedOrFailed(
189
191
...getHeaderArgs ( vscode . workspace . getConfiguration ( ) ) ,
190
192
"start" ,
191
193
"--yes" ,
192
- workspace . owner_name + "/" + workspace . name ,
193
- "--reason" ,
194
- "vscode_connection" ,
194
+ workspace . owner_name + "/" + workspace . name
195
195
] ;
196
+ if ( featureSet . buildReason ) {
197
+ startArgs . push ( ...[ '--reason' , 'vscode_connection' ] )
198
+ }
199
+
196
200
const startProcess = spawn ( binPath , startArgs ) ;
197
201
198
202
startProcess . stdout . on ( "data" , ( data : Buffer ) => {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ export type FeatureSet = {
4
4
vscodessh : boolean ;
5
5
proxyLogDirectory : boolean ;
6
6
wildcardSSH : boolean ;
7
+ buildReason : boolean ;
7
8
} ;
8
9
9
10
/**
@@ -29,5 +30,10 @@ export function featureSetForVersion(
29
30
wildcardSSH :
30
31
( version ? version . compare ( "2.19.0" ) : - 1 ) >= 0 ||
31
32
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" ,
32
38
} ;
33
39
}
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ export class Remote {
68
68
workspace : Workspace ,
69
69
label : string ,
70
70
binPath : string ,
71
+ featureSet : FeatureSet
71
72
) : Promise < Workspace | undefined > {
72
73
const workspaceName = `${ workspace . owner_name } /${ workspace . name } ` ;
73
74
@@ -140,6 +141,7 @@ export class Remote {
140
141
binPath ,
141
142
workspace ,
142
143
writeEmitter ,
144
+ featureSet
143
145
) ;
144
146
break ;
145
147
case "failed" :
@@ -159,6 +161,7 @@ export class Remote {
159
161
binPath ,
160
162
workspace ,
161
163
writeEmitter ,
164
+ featureSet
162
165
) ;
163
166
break ;
164
167
}
@@ -393,6 +396,7 @@ export class Remote {
393
396
workspace ,
394
397
parts . label ,
395
398
binaryPath ,
399
+ featureSet
396
400
) ;
397
401
if ( ! updatedWorkspace ) {
398
402
// User declined to start the workspace.
You can’t perform that action at this time.
0 commit comments