@@ -80,9 +80,9 @@ export class CLIServerBase {
80
80
}
81
81
82
82
private onRequest ( req : http . IncomingMessage , res : http . ServerResponse ) : void {
83
- const sendResponse = ( statusCode : number , returnObj : any ) => {
83
+ const sendResponse = ( statusCode : number , returnObj : string | undefined ) => {
84
84
res . writeHead ( statusCode , { 'content-type' : 'application/json' } ) ;
85
- res . end ( JSON . stringify ( returnObj || null ) , ( err ?: any ) => err && this . logService . error ( err ) ) ;
85
+ res . end ( JSON . stringify ( returnObj || null ) , ( err ?: any ) => err && this . logService . error ( err ) ) ; // CodeQL [SM01524] Only the message portion of errors are passed in.
86
86
} ;
87
87
88
88
const chunks : string [ ] = [ ] ;
@@ -91,7 +91,7 @@ export class CLIServerBase {
91
91
req . on ( 'end' , async ( ) => {
92
92
try {
93
93
const data : PipeCommand | any = JSON . parse ( chunks . join ( '' ) ) ;
94
- let returnObj ;
94
+ let returnObj : string | undefined ;
95
95
switch ( data . type ) {
96
96
case 'open' :
97
97
returnObj = await this . open ( data ) ;
@@ -118,7 +118,7 @@ export class CLIServerBase {
118
118
} ) ;
119
119
}
120
120
121
- private async open ( data : OpenCommandPipeArgs ) : Promise < string > {
121
+ private async open ( data : OpenCommandPipeArgs ) : Promise < undefined > {
122
122
const { fileURIs, folderURIs, forceNewWindow, diffMode, mergeMode, addMode, forceReuseWindow, gotoLineMode, waitMarkerFilePath, remoteAuthority } = data ;
123
123
const urisToOpen : IWindowOpenable [ ] = [ ] ;
124
124
if ( Array . isArray ( folderURIs ) ) {
@@ -147,31 +147,29 @@ export class CLIServerBase {
147
147
const preferNewWindow = ! forceReuseWindow && ! waitMarkerFileURI && ! addMode ;
148
148
const windowOpenArgs : IOpenWindowOptions = { forceNewWindow, diffMode, mergeMode, addMode, gotoLineMode, forceReuseWindow, preferNewWindow, waitMarkerFileURI, remoteAuthority } ;
149
149
this . _commands . executeCommand ( '_remoteCLI.windowOpen' , urisToOpen , windowOpenArgs ) ;
150
-
151
- return '' ;
152
150
}
153
151
154
- private async openExternal ( data : OpenExternalCommandPipeArgs ) : Promise < any > {
152
+ private async openExternal ( data : OpenExternalCommandPipeArgs ) : Promise < undefined > {
155
153
for ( const uriString of data . uris ) {
156
154
const uri = URI . parse ( uriString ) ;
157
155
const urioOpen = uri . scheme === 'file' ? uri : uriString ; // workaround for #112577
158
156
await this . _commands . executeCommand ( '_remoteCLI.openExternal' , urioOpen ) ;
159
157
}
160
158
}
161
159
162
- private async manageExtensions ( data : ExtensionManagementPipeArgs ) : Promise < any > {
160
+ private async manageExtensions ( data : ExtensionManagementPipeArgs ) : Promise < string | undefined > {
163
161
const toExtOrVSIX = ( inputs : string [ ] | undefined ) => inputs ?. map ( input => / \. v s i x $ / i. test ( input ) ? URI . parse ( input ) : input ) ;
164
162
const commandArgs = {
165
163
list : data . list ,
166
164
install : toExtOrVSIX ( data . install ) ,
167
165
uninstall : toExtOrVSIX ( data . uninstall ) ,
168
166
force : data . force
169
167
} ;
170
- return await this . _commands . executeCommand ( '_remoteCLI.manageExtensions' , commandArgs ) ;
168
+ return await this . _commands . executeCommand < string | undefined > ( '_remoteCLI.manageExtensions' , commandArgs ) ;
171
169
}
172
170
173
- private async getStatus ( data : StatusPipeArgs ) {
174
- return await this . _commands . executeCommand ( '_remoteCLI.getSystemStatus' ) ;
171
+ private async getStatus ( data : StatusPipeArgs ) : Promise < string | undefined > {
172
+ return await this . _commands . executeCommand < string | undefined > ( '_remoteCLI.getSystemStatus' ) ;
175
173
}
176
174
177
175
dispose ( ) : void {
0 commit comments