{"version":3,"sources":["../../../config-tools/src/utilities/run.ts"],"names":["execSync","exec"],"mappings":";;;;;AAGO,IAAM,eAAe,IAAA,GAAO,GAAA;AAmB5B,IAAM,GAAA,GAAM,CACjB,MAAA,EACA,OAAA,EACA,MAAc,MAAA,CAAO,aAAA,IAAiB,OAAA,CAAQ,GAAA,EAAI,EAClD,KAAA,GAAsB,SAAA,EACtB,GAAA,GAAyB,QAAQ,GAAA,KAC9B;AACH,EAAA,OAAOA,uBAAS,OAAA,EAAS;AAAA,IACvB,GAAA;AAAA,IACA,GAAA,EAAK;AAAA,MACH,GAAG,OAAA,CAAQ,GAAA;AAAA,MACX,GAAG,GAAA;AAAA,MACH,QAAA,EAAU,MAAA;AAAA,MACV,WAAA,EAAa;AAAA,KACf;AAAA,IACA,WAAA,EAAa,IAAA;AAAA,IACb,KAAA;AAAA,IACA,SAAA,EAAW,YAAA;AAAA,IACX,UAAA,EAAY,SAAA;AAAA,IACZ,QAAA,EAAU;AAAA,GACX,CAAA;AACH;AAcO,IAAM,QAAA,GAAW,CACtB,MAAA,EACA,OAAA,EACA,GAAA,GAAc,MAAA,CAAO,aAAA,IAAiB,OAAA,CAAQ,GAAA,EAAI,EAClD,GAAA,GAAyB,OAAA,CAAQ,GAAA,KAC9B;AACH,EAAA,OAAOC,mBAAK,OAAA,EAAS;AAAA,IACnB,GAAA;AAAA,IACA,GAAA,EAAK;AAAA,MACH,GAAG,OAAA,CAAQ,GAAA;AAAA,MACX,GAAG,GAAA;AAAA,MACH,QAAA,EAAU,MAAA;AAAA,MACV,WAAA,EAAa;AAAA,KACf;AAAA,IACA,WAAA,EAAa,IAAA;AAAA,IACb,SAAA,EAAW,YAAA;AAAA,IACX,UAAA,EAAY,SAAA;AAAA,IACZ,QAAA,EAAU;AAAA,GACX,CAAA;AACH","file":"chunk-MTAYUS7E.cjs","sourcesContent":["import type { StormWorkspaceConfig } from \"@storm-software/config\";\nimport { exec, execSync } from \"node:child_process\";\n\nexport const LARGE_BUFFER = 1024 * 1000000;\nexport type IOType = \"overlapped\" | \"pipe\" | \"ignore\" | \"inherit\";\nexport type StdioOptions =\n  | IOType\n  | Array<IOType | \"ipc\" | number | null | undefined>;\n\n/**\n *  Run a command line process\n *\n * @remarks\n * A wrapper around `execSync` to run our command line processes\n *\n * @param config - The Storm configuration object\n * @param command - The command to run\n * @param cwd - The current working directory\n * @param stdio - The standard input/output options\n * @param env - The environment variables\n * @returns The result of the command\n */\nexport const run = (\n  config: Partial<StormWorkspaceConfig>,\n  command: string,\n  cwd: string = config.workspaceRoot ?? process.cwd(),\n  stdio: StdioOptions = \"inherit\",\n  env: NodeJS.ProcessEnv = process.env\n) => {\n  return execSync(command, {\n    cwd,\n    env: {\n      ...process.env,\n      ...env,\n      CLICOLOR: \"true\",\n      FORCE_COLOR: \"true\"\n    },\n    windowsHide: true,\n    stdio,\n    maxBuffer: LARGE_BUFFER,\n    killSignal: \"SIGTERM\",\n    encoding: \"utf8\"\n  });\n};\n\n/**\n *  Run an asynchronous command line process\n *\n * @remarks\n * A wrapper around `exec` to run our command line processes\n *\n * @param config - The Storm configuration object\n * @param command - The command to run\n * @param cwd - The current working directory\n * @param env - The environment variables\n * @returns A promise with the result of the command\n */\nexport const runAsync = (\n  config: Partial<StormWorkspaceConfig>,\n  command: string,\n  cwd: string = config.workspaceRoot ?? process.cwd(),\n  env: NodeJS.ProcessEnv = process.env\n) => {\n  return exec(command, {\n    cwd,\n    env: {\n      ...process.env,\n      ...env,\n      CLICOLOR: \"true\",\n      FORCE_COLOR: \"true\"\n    },\n    windowsHide: true,\n    maxBuffer: LARGE_BUFFER,\n    killSignal: \"SIGTERM\",\n    encoding: \"utf8\"\n  });\n};\n"]}