UNPKG

multipass-control

Version:

A package to control multipass from within your NodeJS application like launching an image, stopping or deleting images. This package requires Multipass to be installed on your system.

20 lines (16 loc) 489 B
const { spawnSync } = require("child_process"); const run_command = (cmd, args) => { return spawnSync(cmd, args); }; // return each line as an array with each word separated const output_split_array = (cmd) => { const command_output = process.platform === "win32" ? run_command("cmd.exe", ["/c", cmd, "--format", "json"]) : run_command(cmd); return command_output.stdout.toString(); }; module.exports = { run_command, output_split_array, };