github.com/myhau/pulumi/pkg/v3@v3.70.2-0.20221116134521-f2775972e587/codegen/testing/test/testdata/dashed-import-schema/nodejs/scripts/install-pulumi-plugin.js (about)

     1  "use strict";
     2  var childProcess = require("child_process");
     3  
     4  var args = process.argv.slice(2);
     5  
     6  if (args.indexOf("${VERSION}") !== -1) {
     7  	process.exit(0);
     8  }
     9  
    10  var res = childProcess.spawnSync("pulumi", ["plugin", "install"].concat(args), {
    11      stdio: ["ignore", "inherit", "inherit"]
    12  });
    13  
    14  if (res.error && res.error.code === "ENOENT") {
    15      console.error("\nThere was an error installing the resource provider plugin. " +
    16              "It looks like `pulumi` is not installed on your system. " +
    17              "Please visit https://pulumi.com/ to install the Pulumi CLI.\n" +
    18              "You may try manually installing the plugin by running " +
    19              "`pulumi plugin install " + args.join(" ") + "`");
    20  } else if (res.error || res.status !== 0) {
    21      console.error("\nThere was an error installing the resource provider plugin. " +
    22              "You may try to manually installing the plugin by running " +
    23              "`pulumi plugin install " + args.join(" ") + "`");
    24  }
    25  
    26  process.exit(0);