"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.defaultSpawnSyncOptions = void 0;
exports.spawnIO = spawnIO;
exports.spawnSyncIO = spawnSyncIO;

var _child_process = require("child_process");

var _logger = require("../../logger");

var _getCliPath = require("./getCliPath");

const defaultSpawnSyncOptions = {
  stdio: 'inherit'
};
exports.defaultSpawnSyncOptions = defaultSpawnSyncOptions;

function spawnSyncIO(commandName, args, spawnSyncOptions = defaultSpawnSyncOptions) {
  const command = (0, _getCliPath.getCliPath)(commandName);
  const result = (0, _child_process.spawnSync)(command, args, spawnSyncOptions);

  if (result.error || result.stderr) {
    (0, _logger.errorLogger)(result.error || result.stderr);
  } // console.log(result.output);


  process.exit(result.status);
}

function spawnIO(commandName, args, cb) {
  // const result =
  (0, _child_process.spawn)(commandName, args, {
    stdio: 'inherit'
  }, cb); // process.exit(result.status);
}