private static async installNewVersion()

in src/helper/updateHelper.ts [40:67]


  private static async installNewVersion(downloadUrl: string, version: string) {
    const versionProcess = spawn("code", ["--version"]);
    versionProcess.on("error", () => {
      vscode.window.showErrorMessage(
        "'code' command not found in PATH. Please add it via the VS Code Command Palette and try again."
      );
    });

    const savePath = await UpdateHelper.downloadVersion(downloadUrl);
    const downloadProcess = spawn("code", ["--install-extension", savePath]);

    downloadProcess.on("exit", (code) => {
      console.log(`Download process exited with code ${code}`);
      if (code !== 0) {
        vscode.window.showErrorMessage(
          `Assay could not be updated to version ${version}. Please try again.`
        );
        return false;
      }
      fs.unlinkSync(savePath);

      vscode.window.showInformationMessage(
        `Assay updated to version ${version}. Please reload VSCode.`
      );

      return true;
    });
  }