@lark-codem/codem-core 0.8.6-windows-input-diagnostics.202608191235.0.g067fecd → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/lib/launch.js +2 -46
- package/package.json +10 -6
package/bin/lib/launch.js
CHANGED
|
@@ -44,41 +44,6 @@ function hintsFor(code, platform, binary) {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
/// Should the platform binary be spawned with `windowsHide`?
|
|
48
|
-
///
|
|
49
|
-
/// `windowsHide` is not just cosmetic on Windows: libuv translates it into
|
|
50
|
-
/// `CREATE_NO_WINDOW`, and per MSDN "Creation of a Console" a process created
|
|
51
|
-
/// with that flag gets a **brand new console** (merely one without a window)
|
|
52
|
-
/// instead of inheriting the parent's.
|
|
53
|
-
///
|
|
54
|
-
/// For an ordinary child that is harmless — stdout/stdin still reach the
|
|
55
|
-
/// parent's console through the explicitly inherited handles. linco is not an
|
|
56
|
-
/// ordinary child: it is a full-screen TUI, and crossterm does NOT read the
|
|
57
|
-
/// keyboard from inherited fd 0. It opens `CONIN$` (crossterm_winapi
|
|
58
|
-
/// `Handle::current_in_handle`), i.e. the input buffer of **the console this
|
|
59
|
-
/// process is attached to**. Hide the window and the two diverge: the frame
|
|
60
|
-
/// renders fine over the inherited output handle while keystrokes are read
|
|
61
|
-
/// from the freshly allocated, forever-empty buffer.
|
|
62
|
-
///
|
|
63
|
-
/// So: when the parent is already attached to a console, never hide — there is
|
|
64
|
-
/// no window to suppress in that case anyway, which is the only thing the flag
|
|
65
|
-
/// was ever wanted for. When it is not (spawned from a GUI app, a service, or
|
|
66
|
-
/// any other windowless context), keep hiding so no console box flashes up.
|
|
67
|
-
///
|
|
68
|
-
/// Non-Windows platforms ignore the option entirely; keep passing `true` there
|
|
69
|
-
/// so this stays a Windows-only behaviour change.
|
|
70
|
-
function shouldHideWindow({ platform, stdinIsTTY, stdoutIsTTY, stderrIsTTY }) {
|
|
71
|
-
if (platform !== "win32") {
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
// Any std stream being a TTY proves a console is attached. Checking all three
|
|
75
|
-
// (rather than just stdin) keeps redirection from producing a false negative:
|
|
76
|
-
// `codem < input.txt` still has a console, and hiding it there would break
|
|
77
|
-
// the keyboard for exactly the same reason.
|
|
78
|
-
const attachedToConsole = Boolean(stdinIsTTY || stdoutIsTTY || stderrIsTTY);
|
|
79
|
-
return !attachedToConsole;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
47
|
function reportFatal({ error, binary, platform, stderr, exit }) {
|
|
83
48
|
stderr(`linco: failed to launch ${binary}`);
|
|
84
49
|
stderr(` ${error && error.message ? error.message : String(error)}`);
|
|
@@ -103,21 +68,12 @@ function launch({
|
|
|
103
68
|
args,
|
|
104
69
|
stdio,
|
|
105
70
|
platform = process.platform,
|
|
106
|
-
stdinIsTTY = process.stdin.isTTY,
|
|
107
|
-
stdoutIsTTY = process.stdout.isTTY,
|
|
108
|
-
stderrIsTTY = process.stderr.isTTY,
|
|
109
71
|
spawnImpl = require("node:child_process").spawn,
|
|
110
72
|
stderr = (line) => console.error(line),
|
|
111
73
|
exit = (code) => process.exit(code),
|
|
112
74
|
}) {
|
|
113
|
-
const windowsHide = shouldHideWindow({
|
|
114
|
-
platform,
|
|
115
|
-
stdinIsTTY,
|
|
116
|
-
stdoutIsTTY,
|
|
117
|
-
stderrIsTTY,
|
|
118
|
-
});
|
|
119
75
|
const attempt = (stdioForAttempt) =>
|
|
120
|
-
spawnImpl(binary, args, { stdio: stdioForAttempt, windowsHide });
|
|
76
|
+
spawnImpl(binary, args, { stdio: stdioForAttempt, windowsHide: true });
|
|
121
77
|
|
|
122
78
|
let child;
|
|
123
79
|
try {
|
|
@@ -147,4 +103,4 @@ function launch({
|
|
|
147
103
|
return child;
|
|
148
104
|
}
|
|
149
105
|
|
|
150
|
-
module.exports = { launch, hintsFor
|
|
106
|
+
module.exports = { launch, hintsFor };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-codem/codem-core",
|
|
3
|
-
"version": "0.8.6
|
|
3
|
+
"version": "0.8.6",
|
|
4
4
|
"description": "CodeM CLI.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"bin": {
|
|
@@ -11,11 +11,15 @@
|
|
|
11
11
|
"LICENSE"
|
|
12
12
|
],
|
|
13
13
|
"optionalDependencies": {
|
|
14
|
-
"@lark-codem/codem-core-darwin-arm64": "0.8.6
|
|
15
|
-
"@lark-codem/codem-core-
|
|
16
|
-
"@lark-codem/codem-core-linux-
|
|
17
|
-
"@lark-codem/codem-core-
|
|
18
|
-
"@lark-codem/codem-core-
|
|
14
|
+
"@lark-codem/codem-core-darwin-arm64": "0.8.6",
|
|
15
|
+
"@lark-codem/codem-core-darwin-x64": "0.8.6",
|
|
16
|
+
"@lark-codem/codem-core-linux-arm64-gnu": "0.8.6",
|
|
17
|
+
"@lark-codem/codem-core-linux-arm64-musl": "0.8.6",
|
|
18
|
+
"@lark-codem/codem-core-linux-x64-gnu": "0.8.6",
|
|
19
|
+
"@lark-codem/codem-core-linux-x64-musl": "0.8.6",
|
|
20
|
+
"@lark-codem/codem-core-win32-arm64-gnu": "0.8.6",
|
|
21
|
+
"@lark-codem/codem-core-win32-ia32-gnu": "0.8.6",
|
|
22
|
+
"@lark-codem/codem-core-win32-x64-gnu": "0.8.6"
|
|
19
23
|
},
|
|
20
24
|
"engines": {
|
|
21
25
|
"node": ">=18"
|