Skip to content

Commit ba7b1cb

Browse files
committed
cleanup more promises
related to microsoft#53442
1 parent 8766883 commit ba7b1cb

5 files changed

Lines changed: 14 additions & 11 deletions

File tree

src/vs/code/electron-main/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function createServices(args: ParsedArgs, bufferLogService: BufferLogService): I
8181
/**
8282
* Cleans up older logs, while keeping the 10 most recent ones.
8383
*/
84-
async function cleanupOlderLogs(environmentService: EnvironmentService): TPromise<void> {
84+
async function cleanupOlderLogs(environmentService: EnvironmentService): Promise<void> {
8585
const currentLog = path.basename(environmentService.logsPath);
8686
const logsRoot = path.dirname(environmentService.logsPath);
8787
const children = await readdir(logsRoot);

src/vs/code/node/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ interface IMainCli {
3131
main: (argv: ParsedArgs) => TPromise<void>;
3232
}
3333

34-
export async function main(argv: string[]): TPromise<any> {
34+
export async function main(argv: string[]): Promise<any> {
3535
let args: ParsedArgs;
3636

3737
try {

src/vs/code/node/cliProcessMain.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class Main {
181181
}
182182

183183
private uninstallExtension(extensions: string[]): TPromise<any> {
184-
async function getExtensionId(extensionDescription: string): TPromise<string> {
184+
async function getExtensionId(extensionDescription: string): Promise<string> {
185185
if (!/\.vsix$/i.test(extensionDescription)) {
186186
return extensionDescription;
187187
}

src/vs/platform/extensionManagement/node/extensionManagementService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
687687
return promise;
688688
}
689689

690-
private async postUninstallExtension(extension: ILocalExtension, error?: Error): TPromise<void> {
690+
private async postUninstallExtension(extension: ILocalExtension, error?: Error): Promise<void> {
691691
if (error) {
692692
this.logService.error('Failed to uninstall extension:', extension.identifier.id, error.message);
693693
} else {

src/vs/platform/request/node/requestService.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,21 @@ export class RequestService implements IRequestService {
4040
this.authorization = config.http && config.http.proxyAuthorization;
4141
}
4242

43-
async request(options: IRequestOptions, requestFn: IRequestFunction = request): TPromise<IRequestContext> {
43+
request(options: IRequestOptions, requestFn: IRequestFunction = request): TPromise<IRequestContext> {
4444
this.logService.trace('RequestService#request', options.url);
4545

4646
const { proxyUrl, strictSSL } = this;
47+
const agentPromise = options.agent ? TPromise.wrap(options.agent) : TPromise.wrap(getProxyAgent(options.url, { proxyUrl, strictSSL }));
4748

48-
options.agent = options.agent || await getProxyAgent(options.url, { proxyUrl, strictSSL });
49-
options.strictSSL = strictSSL;
49+
return agentPromise.then(agent => {
50+
options.agent = agent;
51+
options.strictSSL = strictSSL;
5052

51-
if (this.authorization) {
52-
options.headers = assign(options.headers || {}, { 'Proxy-Authorization': this.authorization });
53-
}
53+
if (this.authorization) {
54+
options.headers = assign(options.headers || {}, { 'Proxy-Authorization': this.authorization });
55+
}
5456

55-
return requestFn(options);
57+
return requestFn(options);
58+
});
5659
}
5760
}

0 commit comments

Comments
 (0)