From 4b327f072e5c37890b789125a12a96a0b5e538f8 Mon Sep 17 00:00:00 2001 From: Joe Rocklin <124265+joerocklin@users.noreply.github.com> Date: Thu, 8 May 2025 12:42:28 -0400 Subject: [PATCH] Run the task version command in the workspace root folder When using asdf to manage the version of task, this allows the `task version` command to execute in a way that will allow the asdf shim to pick the expected version. Relates to #75 --- src/services/taskfile.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/services/taskfile.ts b/src/services/taskfile.ts index edfdb9f..56b1f81 100644 --- a/src/services/taskfile.ts +++ b/src/services/taskfile.ts @@ -63,8 +63,11 @@ class TaskfileService { } return await new Promise((resolve) => { let command = this.command('--version'); - cp.exec(command, (_, stdout: string, stderr: string) => { + // Determine the root of the working directory of the project + let workspaceFolders = vscode.workspace.workspaceFolders; + let cwd = workspaceFolders && workspaceFolders.length > 0 ? workspaceFolders[0].uri.fsPath : undefined; + cp.exec(command, { cwd }, (_, stdout: string, stderr: string) => { // If the version is a devel version, ignore all version checks if (stdout.includes("devel")) { log.info("Using development version of task");