From b4f63e817efae713c084ccec5838558b221b1cd6 Mon Sep 17 00:00:00 2001 From: Andrew Eisenberg Date: Wed, 2 Mar 2022 12:18:01 -0800 Subject: [PATCH] Ensure structured logging file exists before running a query --- extensions/ql-vscode/src/queryserver-client.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/extensions/ql-vscode/src/queryserver-client.ts b/extensions/ql-vscode/src/queryserver-client.ts index 874cc944961..d24cde2877f 100644 --- a/extensions/ql-vscode/src/queryserver-client.ts +++ b/extensions/ql-vscode/src/queryserver-client.ts @@ -1,5 +1,7 @@ import * as cp from 'child_process'; import * as path from 'path'; +import * as fs from 'fs-extra'; + import { DisposableObject } from './pure/disposable-object'; import { Disposable, CancellationToken, commands } from 'vscode'; import { createMessageConnection, MessageConnection, RequestType } from 'vscode-jsonrpc'; @@ -149,8 +151,11 @@ export class QueryServerClient extends DisposableObject { } if (await this.cliServer.cliConstraints.supportsStructuredEvalLog()) { + const structuredLogFile = `${this.opts.contextStoragePath}/structured-evaluator-log.json`; + await fs.ensureFile(structuredLogFile); + args.push('--evaluator-log'); - args.push(`${this.opts.contextStoragePath}/structured-evaluator-log.json`); + args.push(structuredLogFile); // We hard-code the verbosity level to 5 and minify to false. // This will be the behavior of the per-query structured logging in the CLI after 2.8.3. @@ -163,7 +168,7 @@ export class QueryServerClient extends DisposableObject { } if (cli.shouldDebugQueryServer()) { - args.push('-J=-agentlib:jdwp=transport=dt_socket,address=localhost:9010,server=y,suspend=n,quiet=y'); + args.push('-J=-agentlib:jdwp=transport=dt_socket,address=localhost:9010,server=n,suspend=y,quiet=y'); } const child = cli.spawnServer(