diff --git a/package.json b/package.json index cb81400..96f2960 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "description": "Run several commands concurrently. Show output for one command at a time. Kill all at once.", "repository": "lydell/run-pty", "type": "commonjs", - "bin": "./run-pty.js", + "bin": "./run-pty-bin.js", "files": [ "run-pty.js" ], diff --git a/run-pty-bin.js b/run-pty-bin.js new file mode 100755 index 0000000..0388193 --- /dev/null +++ b/run-pty-bin.js @@ -0,0 +1,21 @@ +#!/usr/bin/env node + +"use strict"; + +// Workaround for: +// https://github.com/lydell/run-pty/issues/45 +// https://github.com/lydell/run-pty/issues/53 +if (process.platform === "linux" && !("UV_USE_IO_URING" in process.env)) { + require("child_process") + .spawn( + process.execPath, + [`${__dirname}/run-pty.js`, ...process.argv.slice(2)], + { + stdio: "inherit", + env: { ...process.env, UV_USE_IO_URING: "0" }, + }, + ) + .on("exit", process.exit); +} else { + require("./run-pty.js").__internalRun(); +} diff --git a/run-pty.js b/run-pty.js index e64d3be..1eca74d 100755 --- a/run-pty.js +++ b/run-pty.js @@ -2569,6 +2569,7 @@ if (require.main === module) { } module.exports = { + __internalRun: run, __forTests: { ALL_LABELS, commandToPresentationName,