Skip to content

Commit

Permalink
Add workaround for io_uring bug on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
lydell committed Mar 19, 2024
1 parent aa96f48 commit 4fa3dc2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
Expand Down
21 changes: 21 additions & 0 deletions run-pty-bin.js
Original file line number Diff line number Diff line change
@@ -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();
}
1 change: 1 addition & 0 deletions run-pty.js
Original file line number Diff line number Diff line change
Expand Up @@ -2569,6 +2569,7 @@ if (require.main === module) {
}

module.exports = {
__internalRun: run,
__forTests: {
ALL_LABELS,
commandToPresentationName,
Expand Down

0 comments on commit 4fa3dc2

Please sign in to comment.