diff --git a/extensions/git/package.json b/extensions/git/package.json index e299d60c118..7077d7e128c 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -1821,7 +1821,7 @@ "@types/byline": "4.2.31", "@types/file-type": "^5.2.1", "@types/mocha": "2.2.43", - "@types/node": "^12.11.7", + "@types/node": "^12.12.31", "@types/which": "^1.0.28", "mocha": "^3.2.0", "mocha-junit-reporter": "^1.23.3", diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index 6f40f62e4a2..851036b15f4 100644 --- a/extensions/git/src/git.ts +++ b/extensions/git/src/git.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { promises as fs, exists } from 'fs'; +import { promises as fs, exists, realpath } from 'fs'; import * as path from 'path'; import * as os from 'os'; import * as cp from 'child_process'; @@ -18,7 +18,6 @@ import { detectEncoding } from './encoding'; import { Ref, RefType, Branch, Remote, GitErrorCodes, LogOptions, Change, Status, CommitOptions } from './api/git'; import * as byline from 'byline'; import { StringDecoder } from 'string_decoder'; -import { promisify } from 'util'; // https://github.com/microsoft/vscode/issues/65693 const MAX_CLI_LENGTH = 30000; @@ -436,10 +435,13 @@ export class Git { const [, letter] = match; try { - const result = await promisify(cp.exec)(`wmic logicaldisk where 'drivetype=4 and deviceid="${letter}:"' get deviceid,providername`); - match = /([A-Z]):\s+(.*?)\s*$/m.exec(result?.stdout.toString() ?? ''); - if (match !== null) { - const [, , networkPath] = match; + const networkPath = await new Promise(resolve => + realpath.native(`${letter}:`, { encoding: 'utf8' }, (err, resolvedPath) => + // eslint-disable-next-line eqeqeq + resolve(err != null ? undefined : resolvedPath), + ), + ); + if (networkPath !== undefined) { return path.normalize( repoUri.fsPath.replace(networkPath, `${letter.toLowerCase()}:`), ); diff --git a/extensions/git/yarn.lock b/extensions/git/yarn.lock index ac135e43a80..17866c54593 100644 --- a/extensions/git/yarn.lock +++ b/extensions/git/yarn.lock @@ -26,10 +26,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.51.tgz#b31d716fb8d58eeb95c068a039b9b6292817d5fb" integrity sha512-El3+WJk2D/ppWNd2X05aiP5l2k4EwF7KwheknQZls+I26eSICoWRhRIJ56jGgw2dqNGQ5LtNajmBU2ajS28EvQ== -"@types/node@^12.11.7": - version "12.11.7" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.11.7.tgz#57682a9771a3f7b09c2497f28129a0462966524a" - integrity sha512-JNbGaHFCLwgHn/iCckiGSOZ1XYHsKFwREtzPwSGCVld1SGhOlmZw2D4ZI94HQCrBHbADzW9m4LER/8olJTRGHA== +"@types/node@^12.12.31": + version "12.12.31" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.31.tgz#d6b4f9645fee17f11319b508fb1001797425da51" + integrity sha512-T+wnJno8uh27G9c+1T+a1/WYCHzLeDqtsGJkoEdSp2X8RTh3oOCZQcUnjAx90CS8cmmADX51O0FI/tu9s0yssg== "@types/which@^1.0.28": version "1.0.28"