diff --git a/extensions/git/src/askpass.ts b/extensions/git/src/askpass.ts index 8c6815b8d1d..b88e1e7ad26 100644 --- a/extensions/git/src/askpass.ts +++ b/extensions/git/src/askpass.ts @@ -10,6 +10,7 @@ import { denodeify } from './util'; import * as path from 'path'; import * as http from 'http'; import * as os from 'os'; +import * as fs from 'fs'; import * as crypto from 'crypto'; const randomBytes = denodeify(crypto.randomBytes); @@ -38,6 +39,7 @@ export class Askpass implements Disposable { private server: http.Server; private ipcHandlePathPromise: Promise; + private ipcHandlePath: string | undefined; private enabled = true; constructor() { @@ -52,6 +54,7 @@ export class Askpass implements Disposable { const buffer = await randomBytes(20); const nonce = buffer.toString('hex'); const ipcHandlePath = getIPCHandlePath(nonce); + this.ipcHandlePath = ipcHandlePath; try { this.server.listen(ipcHandlePath); @@ -110,5 +113,9 @@ export class Askpass implements Disposable { dispose(): void { this.server.close(); + + if (this.ipcHandlePath && process.platform !== 'win32') { + fs.unlinkSync(this.ipcHandlePath); + } } } \ No newline at end of file diff --git a/extensions/git/src/main.ts b/extensions/git/src/main.ts index 230d9be2015..fa155966bbf 100644 --- a/extensions/git/src/main.ts +++ b/extensions/git/src/main.ts @@ -25,6 +25,8 @@ async function init(context: ExtensionContext, outputChannel: OutputChannel, dis const pathHint = workspace.getConfiguration('git').get('path'); const info = await findGit(pathHint, path => outputChannel.appendLine(localize('looking', "Looking for git in: {0}", path))); const askpass = new Askpass(); + disposables.push(askpass); + const env = await askpass.getEnv(); const git = new Git({ gitPath: info.path, version: info.version, env }); const model = new Model(git, context.globalState, outputChannel);