Skip to content

meson executable not found is not reported correctly #304

@Daan-xyz

Description

@Daan-xyz

Not having meson in the path leads to a generic error.

I have a fix but I've been trying longer to create PR, fix personal access tokens, origins, permissions etc on GitHub than the fix took to debug and I really cannot be arsed anymore.

either patch utils.ts to add a specific message:

export function mesonProgram(): string {
  try {
    return which.sync(extensionConfiguration("mesonPath"));
  } catch (e: any) {
    vscode.window.showErrorMessage(
      "Could not find meson executable. See 'Meson Build' in the Output tab for more info.",
    );
    throw e;
  }
}

and/or add diagnostics to the catch block in tasks.ts, as nothing is printed to the output channel because the ENOENT exception object has no .error nor .stderr.

export async function getMesonTasks(buildDir: string, sourceDir: string) {
...

  } catch (e: any) {
    if ("error" in e) {
      getOutputChannel().appendLine(e.error.message);
    }
    if ("stderr" in e) {
      getOutputChannel().appendLine(e.stderr);
    }

    // "Error" object (usually meson not found, code = "ENOENT")
    if ("message" in e) {
      getOutputChannel().appendLine(e.message);
    }

    if ("stack" in e) {
      getOutputChannel().appendLine(e.stack);
    }

    vscode.window.showErrorMessage("Could not fetch targets. See 'Meson Build' in the Output tab for more info.");

    return [];
  }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions