github.com/SAP/cloud-mta-build-tool@v1.2.27/bin/mbt (about)

     1  #!/usr/bin/env node
     2  var path = require("path");
     3  var spawn = require("child_process").spawn;
     4  var fs = require("fs");
     5  
     6  var os = process.env.BINWRAP_PLATFORM || process.platform;
     7  var arch = process.env.BINWRAP_ARCH || process.arch;
     8  
     9  var requested = os + "-" + arch;
    10  var current = process.platform + "-" + process.arch;
    11  if (requested !== current ) {
    12    console.error("WARNING: Using binaries for the requested platform (" + requested + ") instead of for the actual platform (" + current + ").")
    13  }
    14  
    15  var binExt = "";
    16  if (os == "win32") {
    17    binExt = ".exe";
    18  }
    19  
    20  var unpackedBinPath = path.join(__dirname, "..", "unpacked_bin");
    21  var binPath = path.join(unpackedBinPath, "mbt" + binExt);
    22  
    23  function execBin() {
    24    spawn(
    25      binPath,
    26      process.argv.slice(2),
    27      {stdio: 'inherit'}
    28    ).on('exit', process.exit);
    29  }
    30  
    31  if (fs.existsSync(binPath)) {
    32    execBin();
    33  }