From 58f7f5b769505f4ea58dd4694bb61a52f1fc7b66 Mon Sep 17 00:00:00 2001 From: Asher Date: Fri, 25 Oct 2019 11:53:20 -0500 Subject: [PATCH] Properly fix blank --cert flag See #1109. --- scripts/vscode.patch | 11 ++++++++++- src/node/cli.ts | 7 +++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/vscode.patch b/scripts/vscode.patch index cef5f25f..93d927a3 100644 --- a/scripts/vscode.patch +++ b/scripts/vscode.patch @@ -87,7 +87,7 @@ index 990755c4f3..06449bb9cb 100644 + extraBuiltinExtensionPaths: string[]; } diff --git a/src/vs/platform/environment/node/argv.ts b/src/vs/platform/environment/node/argv.ts -index 3e48fe4ddd..e0962b8736 100644 +index 3e48fe4ddd..2212ff5471 100644 --- a/src/vs/platform/environment/node/argv.ts +++ b/src/vs/platform/environment/node/argv.ts @@ -58,6 +58,8 @@ export const OPTIONS: OptionDescriptions> = { @@ -99,6 +99,15 @@ index 3e48fe4ddd..e0962b8736 100644 'list-extensions': { type: 'boolean', cat: 'e', description: localize('listExtensions', "List the installed extensions.") }, 'show-versions': { type: 'boolean', cat: 'e', description: localize('showVersions', "Show versions of installed extensions, when using --list-extension.") }, 'category': { type: 'string', cat: 'e', description: localize('category', "Filters installed extensions by provided category, when using --list-extension.") }, +@@ -185,7 +187,7 @@ export function parseArgs(args: string[], options: OptionDescriptions, err + delete parsedArgs[o.deprecates]; + } + +- if (val) { ++ if (typeof val !== 'undefined') { + if (o.type === 'string[]') { + if (val && !Array.isArray(val)) { + val = [val]; diff --git a/src/vs/platform/environment/node/environmentService.ts b/src/vs/platform/environment/node/environmentService.ts index f7d207009d..5c37b52dab 100644 --- a/src/vs/platform/environment/node/environmentService.ts diff --git a/src/node/cli.ts b/src/node/cli.ts index 0f3e2017..d65397f5 100644 --- a/src/node/cli.ts +++ b/src/node/cli.ts @@ -101,8 +101,11 @@ const startVscode = async (): Promise => { options.password = await generatePassword(); } - // This is necessary since VS Code filters out empty strings. - if (typeof options.cert === "undefined" && process.argv.indexOf("--cert") !== -1) { + if (!options.certKey && typeof options.certKey !== "undefined") { + throw new Error(`--cert-key cannot be blank`); + } else if (options.certKey && !options.cert) { + throw new Error(`--cert-key was provided but --cert was not`); + } if (!options.cert && typeof options.cert !== "undefined") { const { cert, certKey } = await generateCertificate(); options.cert = cert; options.certKey = certKey;