Skip to content

Commit e97d40f

Browse files
committed
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
1 parent 2710d37 commit e97d40f

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
@@ -63,8 +63,11 @@ class TaskfileService {
6363
}
6464
return await new Promise((resolve) => {
6565
let command = this.command('--version');
66-
cp.exec(command, (_, stdout: string, stderr: string) => {
66+
// Determine the root of the working directory of the project
67+
let workspaceFolders = vscode.workspace.workspaceFolders;
68+
let cwd = workspaceFolders && workspaceFolders.length > 0 ? workspaceFolders[0].uri.fsPath : undefined;
6769

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

0 commit comments

Comments
 (0)