@@ -4,14 +4,14 @@ import * as models from '../models';
44import * as path from 'path' ;
55import * as fs from 'fs' ;
66import * as semver from 'semver' ;
7+ import { settings } from '../settings' ;
78import { Octokit } from 'octokit' ;
89import { Endpoints } from "@octokit/types" ;
910
1011const octokit = new Octokit ( ) ;
1112type ReleaseRequest = Endpoints [ "GET /repos/{owner}/{repo}/releases/latest" ] [ "parameters" ] ;
1213type ReleaseResponse = Endpoints [ "GET /repos/{owner}/{repo}/releases/latest" ] [ "response" ] ;
1314
14- const taskCommand = 'task' ;
1515const minimumRequiredVersion = '3.19.1' ;
1616const minimumRecommendedVersion = '3.23.0' ;
1717
@@ -29,9 +29,17 @@ class TaskfileService {
2929 return this . _instance ?? ( this . _instance = new this ( ) ) ;
3030 }
3131
32+ private command ( command ?: string ) : string {
33+ if ( command === undefined ) {
34+ return settings . path ;
35+ }
36+ return `${ settings . path } ${ command } ` ;
37+ }
38+
3239 public async checkInstallation ( ) : Promise < void > {
3340 return await new Promise ( ( resolve ) => {
34- cp . exec ( `${ taskCommand } --version` , ( _ , stdout : string , stderr : string ) => {
41+ let command = this . command ( '--version' ) ;
42+ cp . exec ( command , ( _ , stdout : string , stderr : string ) => {
3543
3644 // If the version is a devel version, ignore all version checks
3745 if ( stdout . includes ( "devel" ) ) {
@@ -109,7 +117,7 @@ class TaskfileService {
109117
110118 public async init ( dir : string ) : Promise < void > {
111119 return await new Promise ( ( resolve ) => {
112- let command = ` ${ taskCommand } --init` ;
120+ let command = this . command ( ' --init' ) ;
113121 cp . exec ( command , { cwd : dir } , ( _ , stdout : string , stderr : string ) => {
114122 if ( stderr ) {
115123 vscode . window . showErrorMessage ( stderr ) ;
@@ -134,7 +142,7 @@ class TaskfileService {
134142
135143 public async read ( dir : string ) : Promise < models . Taskfile > {
136144 return await new Promise ( ( resolve ) => {
137- let command = ` ${ taskCommand } --list-all --json` ;
145+ let command = this . command ( ' --list-all --json' ) ;
138146 cp . exec ( command , { cwd : dir } , ( _ , stdout : string ) => {
139147 var taskfile : models . Taskfile = JSON . parse ( stdout ) ;
140148 taskfile . workspace = dir ;
@@ -154,7 +162,7 @@ class TaskfileService {
154162 public async runTask ( taskName : string , dir ?: string ) : Promise < void > {
155163 return await new Promise ( ( resolve ) => {
156164 // Spawn a child process
157- let child = cp . spawn ( taskCommand , [ taskName ] , { cwd : dir } ) ;
165+ let child = cp . spawn ( this . command ( ) , [ taskName ] , { cwd : dir } ) ;
158166
159167 // Clear the output channel and show it
160168 TaskfileService . outputChannel . clear ( ) ;
0 commit comments