const require_rolldown_runtime = require('../../../../../../../../../_virtual/rolldown_runtime.cjs');
let node_child_process = require("node:child_process");

//#region ../@intlayer/cli/dist/esm/chokidar/dist/esm/utils/runParallel/spawnWin32.mjs
/**
* Kills the new process and its sub processes forcibly.
*/
const createKillHandler = (child) => {
	return () => {
		if (!child.pid) return false;
		try {
			(0, node_child_process.spawn)("taskkill", [
				"/F",
				"/T",
				"/PID",
				String(child.pid)
			], { stdio: "ignore" });
		} catch {}
		return true;
	};
};
/**
* Launches a new process with the given command.
* This is almost same as `child_process.spawn`.
*
* This returns a `ChildProcess` instance.
* `kill` method of the instance kills the new process and its sub processes forcibly.
*
* @param command - The command to run.
* @param args - List of string arguments.
* @param options - Options.
* @returns A ChildProcess instance of new process.
* @private
*/
const spawnWin32 = (command, args, options) => {
	const child = (0, node_child_process.spawn)(command, args, options);
	child.kill = createKillHandler(child);
	return child;
};

//#endregion
exports.spawnWin32 = spawnWin32;
//# sourceMappingURL=spawnWin32.cjs.map