UNPKG

atlas-app-services-cli

Version:

The Atlas App Services Command Line Interface

28 lines (22 loc) 838 B
#!/usr/bin/env node import path from 'path'; import { spawn } from 'child_process'; import { fileURLToPath } from 'url'; function onExit(childProcess) { return new Promise((resolve, reject) => { childProcess.on('exit', code => { if (code === 0) { resolve(); } else { reject(code); } }); }); } const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file const __dirname = path.dirname(__filename); // get the name of the directory const binaryPath = process.platform === 'win32' ? path.join(__dirname, 'appservices.exe') : path.join(__dirname, 'appservices'); const args = process.argv.slice(2); const childProcess = spawn(binaryPath, args, { stdio: [process.stdin, process.stdout, process.stderr] }); onExit(childProcess).catch(code => process.exit(code));