Skip to content

Commit cfc0b4a

Browse files
authored
Run the task version command in the workspace root folder (#181)
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
1 parent d574656 commit cfc0b4a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/services/taskfile.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,11 @@ class TaskfileService {
6464
}
6565
return await new Promise((resolve) => {
6666
let command = this.command('--version');
67-
cp.exec(command, (_, stdout: string, stderr: string) => {
67+
// Determine the root of the working directory of the project
68+
let workspaceFolders = vscode.workspace.workspaceFolders;
69+
let cwd = workspaceFolders && workspaceFolders.length > 0 ? workspaceFolders[0].uri.fsPath : undefined;
6870

71+
cp.exec(command, { cwd }, (_, stdout: string, stderr: string) => {
6972
// If the version is a devel version, ignore all version checks
7073
if (stdout.includes("devel")) {
7174
log.info("Using development version of task");

0 commit comments

Comments
 (0)