Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] Implement promise resolver for 'mesonbuild.build'. #104

Open
RolfNoot opened this issue Dec 30, 2022 · 0 comments
Open

Comments

@RolfNoot
Copy link

Hi,

In an external extension I'm calling await vscode.commands.executeCommand("mesonbuild.build", ""); Unfortunately the function returns immediately without awaiting the build results. I need to wait on completion of the build as this command is part of the prelauch task.

I changed runMesonBuild to solve this issue (I'm not an experienced JS programmer but this works):

export async function runMesonBuild(buildDir: string, name?: string) {
    try {
        let buildTask = await getTask(vscode, "build", name);
        const buildTaskExecution = await vscode.tasks.executeTask(buildTask);
        return new Promise((resolve) => {
            vscode.tasks.onDidEndTaskProcess(e => {
                if (e.execution === buildTaskExecution || e.execution.task === buildTask) 
                    resolve(e.exitCode);
            });
        });
    } catch (e) {
    vscode.window.showErrorMessage(`Could not build ${name}`);
    getOutputChannel().appendLine(`Building target ${name}:`);
    getOutputChannel().appendLine(e);
    getOutputChannel().show(true);
    return new Promise((resolve, reject) => reject(e));
    }
  }

Any chance to have this implemented?
Regards, Rolf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant