noninteractive 0.3.26 → 0.3.27
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/noninteractive.js +7 -3
- package/package.json +1 -1
package/bin/noninteractive.js
CHANGED
|
@@ -379,7 +379,7 @@ var init_daemon = __esm(() => {
|
|
|
379
379
|
var require_package = __commonJS((exports, module) => {
|
|
380
380
|
module.exports = {
|
|
381
381
|
name: "noninteractive",
|
|
382
|
-
version: "0.3.
|
|
382
|
+
version: "0.3.27",
|
|
383
383
|
type: "module",
|
|
384
384
|
bin: {
|
|
385
385
|
noninteractive: "./bin/noninteractive.js"
|
|
@@ -509,6 +509,9 @@ more examples:
|
|
|
509
509
|
npx noninteractive supabase init # session "supabase"
|
|
510
510
|
npx noninteractive start vercel login # explicit start for non-npx commands`;
|
|
511
511
|
function stripAnsi(s) {
|
|
512
|
+
const lastClear = Math.max(s.lastIndexOf("\x1B[2J"), s.lastIndexOf("\x1B[H\x1B[2J"));
|
|
513
|
+
if (lastClear !== -1)
|
|
514
|
+
s = s.slice(lastClear);
|
|
512
515
|
s = s.replace(/\x1b\[[012]?K/g, `
|
|
513
516
|
`);
|
|
514
517
|
let result = "";
|
|
@@ -700,12 +703,13 @@ make sure the command exists. examples:`);
|
|
|
700
703
|
console.error(` npx noninteractive start vercel login # run a command directly`);
|
|
701
704
|
process.exit(1);
|
|
702
705
|
}
|
|
703
|
-
|
|
706
|
+
const stripSpinners = (s) => s.replace(/[\u280B\u2819\u2839\u2838\u283C\u2834\u2826\u2827\u2807\u280F\u281B\u2833\u281E\u283D\u283B\u283F\u283E\u2837\u282F\u281F]/g, "").trim();
|
|
707
|
+
for (let i = 0;i < 150; i++) {
|
|
704
708
|
await new Promise((r) => setTimeout(r, 200));
|
|
705
709
|
try {
|
|
706
710
|
const res = await sendMessage(sock, { action: "read" });
|
|
707
711
|
handleUrls(res, noOpen);
|
|
708
|
-
const clean = stripAnsi(res.output ?? "")
|
|
712
|
+
const clean = stripSpinners(stripAnsi(res.output ?? ""));
|
|
709
713
|
if (clean.length > 10) {
|
|
710
714
|
process.stdout.write(stripAnsi(res.output));
|
|
711
715
|
if (res.exited) {
|