Skip to content

Commit 3461383

Browse files
committed
fix: handle error when no taskfiles are found
1 parent c9881df commit 3461383

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
@@ -138,7 +138,10 @@ class TaskfileService {
138138
public async read(dir: string): Promise<models.Taskfile> {
139139
return await new Promise((resolve, reject) => {
140140
let command = this.command('--list-all --json');
141-
cp.exec(command, { cwd: dir }, (_, stdout: string) => {
141+
cp.exec(command, { cwd: dir }, (err: cp.ExecException | null, stdout: string) => {
142+
if (err) {
143+
return reject();
144+
}
142145
var taskfile: models.Taskfile = JSON.parse(stdout);
143146
if (path.dirname(taskfile.location) !== dir) {
144147
return reject();

0 commit comments

Comments
 (0)