From 5944b842dee27099c31ccfcbea88277dadc10022 Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 31 Jul 2019 15:29:11 -0500 Subject: [PATCH] Make it clearer what the tar code does --- src/cli.ts | 4 +++- src/tar.ts | 15 ++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index 73811c19..dbd1e8e7 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -8,7 +8,7 @@ import pkg from "vs/platform/product/node/package"; import product from "vs/platform/product/node/product"; import { MainServer } from "vs/server/src/server"; -import "vs/server/src/tar"; +import { enableExtensionTars } from "vs/server/src/tar"; import { AuthType, buildAllowedMessage, generateCertificate, generatePassword, localRequire, open, unpackExecutables } from "vs/server/src/util"; const { logger } = localRequire("@coder/logger/out/index"); @@ -96,6 +96,8 @@ const main = async (): Promise => { return buildVersionMessage(version, product.commit).split("\n").map((line) => logger.info(line)); } + enableExtensionTars(); + const shouldSpawnCliProcess = (): boolean => { return !!args["install-source"] || !!args["list-extensions"] diff --git a/src/tar.ts b/src/tar.ts index 096846f3..73156f64 100644 --- a/src/tar.ts +++ b/src/tar.ts @@ -153,8 +153,13 @@ const extractTar = async (tarPath: string, targetPath: string, options: IExtract }); }; -// Override original functionality so we can use tar instead of zip. -const target = vszip as typeof vszip; -target.zip = tar; -target.extract = extract; -target.buffer = buffer; +/** + * Override original functionality so we can use extensions that are in a tar in + * addition to zips. + */ +export const enableExtensionTars = (): void => { + const target = vszip as typeof vszip; + target.zip = tar; + target.extract = extract; + target.buffer = buffer; +};