cliprobe 1.5.0 → 1.6.0
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/README.md +18 -14
- package/dist/cli.js +99 -27
- package/package.json +1 -1
- package/schema.json +17 -0
package/README.md
CHANGED
|
@@ -58,8 +58,8 @@ sigterm
|
|
|
58
58
|
SKIP tsx needs a probe that keeps running, such as a watch or serve command (--probe), or --bare
|
|
59
59
|
|
|
60
60
|
restore
|
|
61
|
-
PASS tsx --version left no terminal mode switched on when it exited
|
|
62
|
-
PASS tsx --help left no terminal mode switched on when it exited
|
|
61
|
+
PASS tsx --version left no terminal mode switched on and the terminal's settings as it found them when it exited
|
|
62
|
+
PASS tsx --help left no terminal mode switched on and the terminal's settings as it found them when it exited
|
|
63
63
|
|
|
64
64
|
control-chars
|
|
65
65
|
SKIP tsx no {fixture} in the arguments; add a probe that takes a path, e.g. --probe "ls {fixture}"
|
|
@@ -293,15 +293,17 @@ In the census of the top 100 npm CLIs, 9 of 238 `--help` and `--version` runs fa
|
|
|
293
293
|
|
|
294
294
|
cliprobe lets the command run for 1 second, then sends SIGINT to its process group, which is what a terminal does when you press Ctrl-C, and gives it 3 seconds to exit. stdin is left open, as a terminal leaves it, so a server that stops at the end of stdin (`esbuild --serve`) keeps running until the Ctrl-C. Results:
|
|
295
295
|
|
|
296
|
-
| Verdict | Meaning
|
|
297
|
-
| ------- |
|
|
298
|
-
| `PASS` | Stopped by SIGINT, exited 130 (the convention), or exited with another failure code
|
|
299
|
-
| `FAIL` | Still running 3 seconds later, or printed a stack trace or traceback after the Ctrl-C
|
|
300
|
-
| `WARN` | Exited 0, so a script or an agent can't tell the work was interrupted, or exited but left processes running that ignored the Ctrl-C (the evidence names the first)
|
|
301
|
-
| `SKIP` | Finished before the Ctrl-C, as `--version` and `--help` do: probe a command that keeps running
|
|
296
|
+
| Verdict | Meaning |
|
|
297
|
+
| ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
298
|
+
| `PASS` | Stopped by SIGINT, exited 130 (the convention), or exited with another failure code |
|
|
299
|
+
| `FAIL` | Still running 3 seconds later, or printed a stack trace or traceback after the Ctrl-C |
|
|
300
|
+
| `WARN` | Exited 0, so a script or an agent can't tell the work was interrupted, or exited but left processes running that ignored the Ctrl-C (the evidence names the first) |
|
|
301
|
+
| `SKIP` | Finished before the Ctrl-C, as `--version` and `--help` do: probe a command that keeps running. With `--bare`, also a command still running after the Ctrl-C that never printed anything, as a REPL does |
|
|
302
302
|
|
|
303
303
|
A stack trace printed before the Ctrl-C doesn't count. Python's default `KeyboardInterrupt` traceback is the classic failure here, so `python3 -c 'import time; time.sleep(30)'` fails. Across 42 watch modes, dev servers and long tasks run offline (vite, webpack, tsc, jest, Next.js, Nuxt, Astro, wrangler, nodemon and more), every one stopped within 60 ms of the Ctrl-C, whether it came after 1, 3 or 6 seconds, so the timing rarely matters. 13 of them exit 0 on purpose, among them `tsc --watch`, webpack, `next dev` and `nuxt dev`: that is a warn, not a fail.
|
|
304
304
|
|
|
305
|
+
A REPL run with `--bare` (`npx cliprobe --bare -- python3`) gets a pipe as stdin here, not a terminal, so it waits to read a script and may not stop on Ctrl-C, which nobody at a terminal sees. So with `--bare`, a command that is still running 3 seconds after the Ctrl-C and never printed anything is skipped, as restore skips REPLs, rather than failed. One that printed something first, such as a server's banner, still fails. To check a REPL's Ctrl-C, try it in a terminal.
|
|
306
|
+
|
|
305
307
|
The verdict is about the program itself: it passes once it exits, even if a child still holds its output open. What it leaves running gets 1 more second to follow, then is listed and killed. A process still there ignored the Ctrl-C, as a shell's background job does (`sh -c 'worker & server'`), so it would outlive the terminal's Ctrl-C too: that is a warn, added in 1.4.
|
|
306
308
|
|
|
307
309
|
### sigterm
|
|
@@ -318,13 +320,13 @@ It only warns for now. Across 44 watch modes, dev servers and long tasks run off
|
|
|
318
320
|
|
|
319
321
|
### restore
|
|
320
322
|
|
|
321
|
-
Spinners, prompts and full-screen programs switch terminal modes on: they hide the cursor, open the alternate screen, turn on mouse reporting or bracketed paste, or turn line wrapping off. If they don't switch them back off on the way out, the shell they return to is broken until you run `reset`: no cursor, a blank screen, mouse clicks typed as junk, long lines cut off at the edge. cliprobe runs the command under a terminal and, for probes you write, types Ctrl-C after 1 second, as a person would. The keystroke goes through the terminal, so a program in raw mode gets it as a key rather than a signal, just as it would from a keyboard. `--version` and `--help` aren't interrupted; they're judged as they exit. Results:
|
|
323
|
+
Spinners, prompts and full-screen programs switch terminal modes on: they hide the cursor, open the alternate screen, turn on mouse reporting or bracketed paste, or turn line wrapping off. If they don't switch them back off on the way out, the shell they return to is broken until you run `reset`: no cursor, a blank screen, mouse clicks typed as junk, long lines cut off at the edge. Prompts and full-screen programs also put the terminal in raw mode (echo and line editing off, from `stty`), and one that exits without switching it back leaves a shell that shows nothing you type. cliprobe runs the command under a terminal and, for probes you write, types Ctrl-C after 1 second, as a person would. The keystroke goes through the terminal, so a program in raw mode gets it as a key rather than a signal, just as it would from a keyboard. `--version` and `--help` aren't interrupted; they're judged as they exit. Since 1.6, cliprobe also reads the terminal's settings with `stty -a` just before the program starts and just after it exits, and compares them: line editing (`icanon`), `echo`, `isig`, `iexten`, output processing (`opost`, `onlcr`), `icrnl` and `ixon`. Results:
|
|
322
324
|
|
|
323
|
-
| Verdict | Meaning
|
|
324
|
-
| ------- |
|
|
325
|
-
| `PASS` | Left no mode switched on, either because it never switched one or because it switched each back off (or reset the terminal) |
|
|
326
|
-
| `WARN` | Left one or more on; the evidence quotes each sequence that was never undone and its line
|
|
327
|
-
| `SKIP` | Still running 3 seconds after Ctrl-C (REPLs quit on a second one), more than 1 MiB of output, or no usable `script` command
|
|
325
|
+
| Verdict | Meaning |
|
|
326
|
+
| ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
327
|
+
| `PASS` | Left no mode switched on, either because it never switched one or because it switched each back off (or reset the terminal), and left the terminal's settings as it found them |
|
|
328
|
+
| `WARN` | Left one or more on, or switched a setting off and left it off (raw mode); the evidence quotes each sequence that was never undone and its line, and the settings as `stty` flags such as `-icanon -echo` |
|
|
329
|
+
| `SKIP` | Still running 3 seconds after Ctrl-C (REPLs quit on a second one), more than 1 MiB of output, or no usable `script` command |
|
|
328
330
|
|
|
329
331
|
It only warns: a terminal left in the wrong mode is a nuisance you can undo, not a failure of the program's job. Across the top 100 npm CLIs, their watch modes and servers, and popular prompt and spinner libraries (about 300 runs), nothing warned falsely, and one tool really did break the terminal: `taze -I` turns line wrapping off for its progress bars and leaves it off after Ctrl-C.
|
|
330
332
|
|
|
@@ -418,6 +420,8 @@ process.on('exit', () => process.stdout.write('\x1b[?25h')); // and always show
|
|
|
418
420
|
process.once('SIGINT', () => process.exit(130));
|
|
419
421
|
```
|
|
420
422
|
|
|
423
|
+
Node switches raw mode (`setRawMode`) back off on its own as it exits, but not when it is killed. In other languages, restore the terminal's settings yourself: in Python, save `termios.tcgetattr(fd)` and put it back with `tcsetattr` in a `finally`, instead of calling `os._exit()` while the terminal is raw.
|
|
424
|
+
|
|
421
425
|
**control-chars:** escape names (and any other text you didn't write) before printing them for a person. `JSON.stringify` alone isn't enough: it leaves C1 controls and bidi overrides raw.
|
|
422
426
|
|
|
423
427
|
```js
|
package/dist/cli.js
CHANGED
|
@@ -1094,12 +1094,18 @@ function shellQuote(arg) {
|
|
|
1094
1094
|
* program as argv; only the util-linux form needs quoting, because its -c takes
|
|
1095
1095
|
* a single string.
|
|
1096
1096
|
*/
|
|
1097
|
-
function ptyArgs(flavor, pidFile, command, args, cols = 80, rows = 24) {
|
|
1098
|
-
const
|
|
1099
|
-
const
|
|
1097
|
+
function ptyArgs(flavor, pidFile, command, args, cols = 80, rows = 24, settingsFile) {
|
|
1098
|
+
const size = `stty cols ${cols} rows ${rows} 2>/dev/null`;
|
|
1099
|
+
const setup = settingsFile === void 0 ? `echo $$ > "$1"; shift; ${size}; exec "$@"` : `echo $$ > "$1"; s=$2; shift 2; ${size}; stty -a > "$s.before" 2>/dev/null; trap true INT; "$@"; c=$?; stty -a > "$s.after" 2>/dev/null; exit $c`;
|
|
1100
|
+
const argv = settingsFile === void 0 ? [
|
|
1100
1101
|
pidFile,
|
|
1101
1102
|
command,
|
|
1102
1103
|
...args
|
|
1104
|
+
] : [
|
|
1105
|
+
pidFile,
|
|
1106
|
+
settingsFile,
|
|
1107
|
+
command,
|
|
1108
|
+
...args
|
|
1103
1109
|
];
|
|
1104
1110
|
if (flavor === "bsd") return [
|
|
1105
1111
|
"-q",
|
|
@@ -1116,6 +1122,28 @@ function ptyArgs(flavor, pidFile, command, args, cols = 80, rows = 24) {
|
|
|
1116
1122
|
"/dev/null"
|
|
1117
1123
|
];
|
|
1118
1124
|
}
|
|
1125
|
+
/** The terminal settings that leave a shell unusable when a program exits with them off. */
|
|
1126
|
+
const WATCHED_SETTINGS = [
|
|
1127
|
+
"icanon",
|
|
1128
|
+
"echo",
|
|
1129
|
+
"isig",
|
|
1130
|
+
"iexten",
|
|
1131
|
+
"opost",
|
|
1132
|
+
"onlcr",
|
|
1133
|
+
"icrnl",
|
|
1134
|
+
"ixon"
|
|
1135
|
+
];
|
|
1136
|
+
/**
|
|
1137
|
+
* The watched settings that were on in `before` and are off in `after`, both the
|
|
1138
|
+
* output of `stty -a`, where BSD and GNU stty alike print a setting that is off as
|
|
1139
|
+
* `-name`. Compared with the terminal as the program found it, not fixed values.
|
|
1140
|
+
*/
|
|
1141
|
+
function settingsOff(before, after) {
|
|
1142
|
+
const words = (text) => new Set(text.split(/[\s;]+/));
|
|
1143
|
+
const was = words(before);
|
|
1144
|
+
const now = words(after);
|
|
1145
|
+
return WATCHED_SETTINGS.filter((name) => was.has(name) && now.has(`-${name}`));
|
|
1146
|
+
}
|
|
1119
1147
|
/** BSD script echoes the EOF it forwards from /dev/null as "^D" and two backspaces. */
|
|
1120
1148
|
const BSD_EOF_ECHO = "^D\b\b";
|
|
1121
1149
|
/** Undoes the terminal's output processing: the EOF echo, and \n turned into \r\n. */
|
|
@@ -1131,7 +1159,7 @@ function cleanPtyOutput(raw, flavor) {
|
|
|
1131
1159
|
* the terminal's line discipline handles what is typed, so Ctrl-C (\x03) becomes
|
|
1132
1160
|
* SIGINT for the program, or a keypress if the program turned that off.
|
|
1133
1161
|
*/
|
|
1134
|
-
async function runPty(command, args, { timeout, env = {}, input }) {
|
|
1162
|
+
async function runPty(command, args, { timeout, env = {}, input, settings = false }) {
|
|
1135
1163
|
const support = ptySupport();
|
|
1136
1164
|
if (!support.ok) throw new Error(`no PTY: ${support.reason}`);
|
|
1137
1165
|
const dir = mkdtempSync(join(tmpdir(), "cliprobe-pty-"));
|
|
@@ -1141,7 +1169,8 @@ async function runPty(command, args, { timeout, env = {}, input }) {
|
|
|
1141
1169
|
}));
|
|
1142
1170
|
const pidFile = join(dir, "pid");
|
|
1143
1171
|
let launcher = "script";
|
|
1144
|
-
|
|
1172
|
+
const settingsFile = settings ? join(dir, "stty") : void 0;
|
|
1173
|
+
let argv = ptyArgs(support.flavor, pidFile, command, args, 80, 24, settingsFile);
|
|
1145
1174
|
let keyboard;
|
|
1146
1175
|
let inputSentMs;
|
|
1147
1176
|
let typeTimer;
|
|
@@ -1191,7 +1220,8 @@ async function runPty(command, args, { timeout, env = {}, input }) {
|
|
|
1191
1220
|
...result.spawnError === void 0 ? {} : { spawnError: result.spawnError },
|
|
1192
1221
|
scriptStderr: result.stderr,
|
|
1193
1222
|
truncated: result.stdoutBytes > result.stdout.length,
|
|
1194
|
-
...inputSentMs === void 0 ? {} : { inputSentMs }
|
|
1223
|
+
...inputSentMs === void 0 ? {} : { inputSentMs },
|
|
1224
|
+
...readSettings(settingsFile, result.timedOut)
|
|
1195
1225
|
};
|
|
1196
1226
|
} finally {
|
|
1197
1227
|
clearTimeout(typeTimer);
|
|
@@ -1204,6 +1234,15 @@ async function runPty(command, args, { timeout, env = {}, input }) {
|
|
|
1204
1234
|
});
|
|
1205
1235
|
}
|
|
1206
1236
|
}
|
|
1237
|
+
/** The settings the program left off, when the wrapper could read them after it. */
|
|
1238
|
+
function readSettings(file, timedOut) {
|
|
1239
|
+
if (file === void 0 || timedOut) return {};
|
|
1240
|
+
try {
|
|
1241
|
+
return { settingsOff: settingsOff(readFileSync(`${file}.before`, "utf8"), readFileSync(`${file}.after`, "utf8")) };
|
|
1242
|
+
} catch {
|
|
1243
|
+
return {};
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1207
1246
|
/** How often to look for the end of a program that is being typed to. */
|
|
1208
1247
|
const EXIT_POLL_MS = 50;
|
|
1209
1248
|
function programGroup(pidFile) {
|
|
@@ -1216,7 +1255,8 @@ function programGroup(pidFile) {
|
|
|
1216
1255
|
}
|
|
1217
1256
|
/**
|
|
1218
1257
|
* Whether the program under the PTY has started, is running, or has exited.
|
|
1219
|
-
* Asks about the program itself
|
|
1258
|
+
* Asks about the program itself (or the wrapper that runs it and reads the
|
|
1259
|
+
* settings it left, which ends right after it), which script(1) reaps, not its group: a child
|
|
1220
1260
|
* it left behind can stay a zombie for good where nothing reaps orphans, as in
|
|
1221
1261
|
* a container without an init process.
|
|
1222
1262
|
*/
|
|
@@ -1710,7 +1750,12 @@ const CTRL_C_GRACE_MS = 3e3;
|
|
|
1710
1750
|
const CTRL_C_LEFTOVERS_MS = 1e3;
|
|
1711
1751
|
/** Lines worth quoting from a trace printed on Ctrl-C, best first. */
|
|
1712
1752
|
const TRACE_MESSAGES = [/^(KeyboardInterrupt|\w*Error\b|\w*Exception\b|panic:)/, TRACE_RE];
|
|
1713
|
-
|
|
1753
|
+
/**
|
|
1754
|
+
* `bare` is true for the --bare probe, the command with no arguments. A REPL run that
|
|
1755
|
+
* way (python3) gets a pipe as stdin, reads it as a script and doesn't stop on SIGINT,
|
|
1756
|
+
* which no one at a terminal sees; restore, under a terminal, skips REPLs too (#43).
|
|
1757
|
+
*/
|
|
1758
|
+
function judgeCtrlC(r, bare = false) {
|
|
1714
1759
|
if (r.spawnError) return {
|
|
1715
1760
|
verdict: "error",
|
|
1716
1761
|
reason: `could not start: ${r.spawnError}`
|
|
@@ -1719,10 +1764,16 @@ function judgeCtrlC(r) {
|
|
|
1719
1764
|
verdict: "skip",
|
|
1720
1765
|
reason: `finished in ${r.durationMs} ms, before Ctrl-C at ${CTRL_C_DELAY_MS} ms; probe a command that keeps running`
|
|
1721
1766
|
}, r);
|
|
1722
|
-
if (r.timedOut)
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1767
|
+
if (r.timedOut) {
|
|
1768
|
+
if (bare && r.stdoutBytes === 0 && r.stderr === "") return {
|
|
1769
|
+
verdict: "skip",
|
|
1770
|
+
reason: `still running ${CTRL_C_GRACE_MS / 1e3} s after Ctrl-C without printing anything, as a REPL does when stdin is a pipe (it waits for a script, not a keypress); run it in a terminal to check its Ctrl-C`
|
|
1771
|
+
};
|
|
1772
|
+
return {
|
|
1773
|
+
verdict: "fail",
|
|
1774
|
+
reason: `ignored Ctrl-C: still running ${CTRL_C_GRACE_MS / 1e3} s later`
|
|
1775
|
+
};
|
|
1776
|
+
}
|
|
1726
1777
|
const after = r.stderr.slice(r.stderrAtSignal ?? 0);
|
|
1727
1778
|
const ms = `${r.durationMs - r.signalSentMs} ms`;
|
|
1728
1779
|
if (TRACE_RE.test(after)) return {
|
|
@@ -1770,7 +1821,7 @@ async function ctrlC(command, args) {
|
|
|
1770
1821
|
return {
|
|
1771
1822
|
check: "ctrl-c",
|
|
1772
1823
|
invocation: [command, ...args],
|
|
1773
|
-
...judgeCtrlC(r),
|
|
1824
|
+
...judgeCtrlC(r, args.length === 0),
|
|
1774
1825
|
sentAfterMs: sent ?? null,
|
|
1775
1826
|
exitedAfterMs: sent === void 0 || r.timedOut ? null : r.durationMs - sent,
|
|
1776
1827
|
exitCode: r.exitCode,
|
|
@@ -1902,7 +1953,9 @@ const pipeEscapesCheck = {
|
|
|
1902
1953
|
};
|
|
1903
1954
|
// src/checks/restore.ts
|
|
1904
1955
|
function listLabels(modes) {
|
|
1905
|
-
|
|
1956
|
+
return listWords(modes.map((m) => m.label));
|
|
1957
|
+
}
|
|
1958
|
+
function listWords(labels) {
|
|
1906
1959
|
return labels.length <= 1 ? labels[0] ?? "" : `${labels.slice(0, -1).join(", ")} and ${labels.at(-1) ?? ""}`;
|
|
1907
1960
|
}
|
|
1908
1961
|
/** The PTY wrapper's own complaint when it can't exec the program. */
|
|
@@ -1925,14 +1978,26 @@ function judgeRestore(r) {
|
|
|
1925
1978
|
};
|
|
1926
1979
|
const when = interrupted ? "after Ctrl-C" : "when it exited";
|
|
1927
1980
|
const open = findOpenModes(r.output);
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
evidence
|
|
1932
|
-
|
|
1981
|
+
const off = r.settingsOff ?? [];
|
|
1982
|
+
if (open.length > 0 || off.length > 0) {
|
|
1983
|
+
const parts = open.length > 0 ? [`with ${listLabels(open)}`] : [];
|
|
1984
|
+
const evidence = open.map((m) => `${m.sequence} on line ${m.line}, never undone`);
|
|
1985
|
+
if (off.length > 0) {
|
|
1986
|
+
const raw = off.includes("icanon") && off.includes("echo");
|
|
1987
|
+
const flags = off.map((name) => `-${name}`);
|
|
1988
|
+
parts.push(raw ? `in raw mode (${listWords(off)} off)` : `with ${listWords(off)} off (${flags.join(" ")})`);
|
|
1989
|
+
evidence.push(`stty settings never restored: ${flags.join(" ")}`);
|
|
1990
|
+
}
|
|
1991
|
+
const fix = off.length > 0 ? "; `stty sane` undoes it" : "";
|
|
1992
|
+
return {
|
|
1993
|
+
verdict: "warn",
|
|
1994
|
+
reason: `left the terminal ${parts.join(" and ")} ${when}${fix}`,
|
|
1995
|
+
evidence: evidence.join("; ")
|
|
1996
|
+
};
|
|
1997
|
+
}
|
|
1933
1998
|
return {
|
|
1934
1999
|
verdict: "pass",
|
|
1935
|
-
reason: `left no terminal mode switched on ${when}`
|
|
2000
|
+
reason: `left no terminal mode switched on${r.settingsOff === void 0 ? "" : " and the terminal's settings as it found them"} ${when}`
|
|
1936
2001
|
};
|
|
1937
2002
|
}
|
|
1938
2003
|
async function restore(command, args, { timeout, interrupt }) {
|
|
@@ -1941,9 +2006,11 @@ async function restore(command, args, { timeout, interrupt }) {
|
|
|
1941
2006
|
...interrupt ? { input: {
|
|
1942
2007
|
data: CTRL_C_KEY,
|
|
1943
2008
|
afterMs: CTRL_C_DELAY_MS
|
|
1944
|
-
} } : {}
|
|
2009
|
+
} } : {},
|
|
2010
|
+
settings: true
|
|
1945
2011
|
});
|
|
1946
|
-
const
|
|
2012
|
+
const notRun = r.spawnError === void 0 && (r.exitCode === 126 || r.exitCode === 127 || WRAPPER_EXEC_FAILED.test(r.output)) && cannotExecute(command);
|
|
2013
|
+
const judgement = judgeRestore(notRun ? {
|
|
1947
2014
|
...r,
|
|
1948
2015
|
spawnError: notAProgram(command, "the terminal's shell could not exec it")
|
|
1949
2016
|
} : r);
|
|
@@ -1952,7 +2019,8 @@ async function restore(command, args, { timeout, interrupt }) {
|
|
|
1952
2019
|
invocation: [command, ...args],
|
|
1953
2020
|
...judgement,
|
|
1954
2021
|
interrupted: r.inputSentMs !== void 0,
|
|
1955
|
-
openModes: judgement.verdict === "warn" ? findOpenModes(r.output) : []
|
|
2022
|
+
openModes: judgement.verdict === "warn" ? findOpenModes(r.output) : [],
|
|
2023
|
+
settingsOff: notRun ? null : r.settingsOff ?? null
|
|
1956
2024
|
};
|
|
1957
2025
|
}
|
|
1958
2026
|
const restoreCheck = {
|
|
@@ -1976,7 +2044,8 @@ const restoreCheck = {
|
|
|
1976
2044
|
invocation: [target.command, ...args],
|
|
1977
2045
|
...notRun,
|
|
1978
2046
|
interrupted: false,
|
|
1979
|
-
openModes: []
|
|
2047
|
+
openModes: [],
|
|
2048
|
+
settingsOff: null
|
|
1980
2049
|
};
|
|
1981
2050
|
results.push(result);
|
|
1982
2051
|
continue;
|
|
@@ -2802,7 +2871,9 @@ Checks:
|
|
|
2802
2871
|
prints a stack trace; warns if it exits 0, or exits and leaves
|
|
2803
2872
|
processes running that ignored the Ctrl-C. Skipped when the
|
|
2804
2873
|
command finishes first, so probe a command that keeps running
|
|
2805
|
-
(a watcher, a server, a long task), e.g. with --probe "serve"
|
|
2874
|
+
(a watcher, a server, a long task), e.g. with --probe "serve";
|
|
2875
|
+
with --bare, also when a silent command outlives the Ctrl-C,
|
|
2876
|
+
as a REPL reading a pipe does.
|
|
2806
2877
|
sigterm Sends SIGTERM to the command alone after 1 s, as kill, docker
|
|
2807
2878
|
stop and process managers do. Warns if it is still running 3 s
|
|
2808
2879
|
later, prints a stack trace, or exits and leaves child
|
|
@@ -2811,8 +2882,9 @@ Checks:
|
|
|
2811
2882
|
restore Runs the command under a terminal and, for your own probes,
|
|
2812
2883
|
types Ctrl-C after 1 s, as a person would. Warns if it leaves
|
|
2813
2884
|
the cursor hidden, the alternate screen, mouse or focus
|
|
2814
|
-
reporting, bracketed paste or line wrapping off,
|
|
2815
|
-
|
|
2885
|
+
reporting, bracketed paste or line wrapping off, or the
|
|
2886
|
+
terminal in raw mode (echo and line editing off, from stty),
|
|
2887
|
+
which breaks the shell it returns to.
|
|
2816
2888
|
control-chars Runs the command under a terminal with {fixture} replaced by a
|
|
2817
2889
|
directory of file names holding escape sequences, a carriage
|
|
2818
2890
|
return, a newline and more. Fails if an escape sequence reaches
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cliprobe",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Black-box test any command-line program for terminal-edge bugs: crashes on a closed pipe (| head), color and control codes leaking into pipes, hangs waiting on stdin, broken Ctrl-C handling, child processes left running after SIGTERM, a terminal left broken after Ctrl-C, and control characters from file names reaching your terminal.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/schema.json
CHANGED
|
@@ -532,6 +532,23 @@
|
|
|
532
532
|
"type": "boolean",
|
|
533
533
|
"description": "Whether Ctrl-C was typed; false when the program exited first."
|
|
534
534
|
},
|
|
535
|
+
"settingsOff": {
|
|
536
|
+
"type": ["array", "null"],
|
|
537
|
+
"description": "The terminal settings (stty) it switched off and left off, such as icanon and echo for raw mode; null when they could not be read. Added in 1.6.",
|
|
538
|
+
"items": {
|
|
539
|
+
"type": "string",
|
|
540
|
+
"enum": [
|
|
541
|
+
"icanon",
|
|
542
|
+
"echo",
|
|
543
|
+
"isig",
|
|
544
|
+
"iexten",
|
|
545
|
+
"opost",
|
|
546
|
+
"onlcr",
|
|
547
|
+
"icrnl",
|
|
548
|
+
"ixon"
|
|
549
|
+
]
|
|
550
|
+
}
|
|
551
|
+
},
|
|
535
552
|
"openModes": {
|
|
536
553
|
"type": "array",
|
|
537
554
|
"description": "The terminal modes it left switched on.",
|