noninteractive 0.3.32 → 0.3.34

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.
@@ -404,7 +404,7 @@ var init_daemon = __esm(() => {
404
404
  var require_package = __commonJS((exports, module) => {
405
405
  module.exports = {
406
406
  name: "noninteractive",
407
- version: "0.3.32",
407
+ version: "0.3.34",
408
408
  type: "module",
409
409
  bin: {
410
410
  noninteractive: "./bin/noninteractive.js"
@@ -691,6 +691,15 @@ async function start(cmdArgs, noOpen = false, sessionName, cwd) {
691
691
  try {
692
692
  await sendMessage(sock2, { action: "stop" }, 2000);
693
693
  } catch {}
694
+ for (let j = 0;j < 20; j++) {
695
+ if (!existsSync2(sock2))
696
+ break;
697
+ await new Promise((r) => setTimeout(r, 100));
698
+ }
699
+ try {
700
+ const { unlinkSync: unlinkSync2 } = await import("fs");
701
+ unlinkSync2(sock2);
702
+ } catch {}
694
703
  } else {
695
704
  console.error(`session '${name}' is already running. use a different --name or stop it first:`);
696
705
  console.error(` npx noninteractive stop ${name}`);
@@ -760,8 +769,10 @@ make sure the command exists. examples:`);
760
769
  if (res.exited) {
761
770
  process.stdout.write(stripAnsi(res.output ?? ""));
762
771
  console.log(`
763
- [session '${name}' exited ${res.exitCode} \u2014 the command failed]`);
764
- console.log(`hint: the first argument to "start" is the command to run, NOT a session name.`);
772
+ [session '${name}' exited ${res.exitCode}]`);
773
+ if (i < 10) {
774
+ console.log(`hint: the first argument to "start" is the command to run, NOT a session name.`);
775
+ }
765
776
  console.log(` npx noninteractive start npx vercel # run an npx package`);
766
777
  console.log(` npx noninteractive start vercel login # run a command directly`);
767
778
  return;
@@ -809,6 +820,22 @@ async function send(name, text, wait, timeout, noOpen = false) {
809
820
  text = "\r";
810
821
  text = text.replace(/\\x([0-9a-fA-F]{2})/g, (_, hex) => String.fromCharCode(parseInt(hex, 16))).replace(/\\r/g, "\r").replace(/\\n/g, `
811
822
  `).replace(/\\t/g, "\t");
823
+ const keyHints = {
824
+ ENTER: "\\r",
825
+ RETURN: "\\r",
826
+ DOWN: "\\x1b[B",
827
+ UP: "\\x1b[A",
828
+ LEFT: "\\x1b[D",
829
+ RIGHT: "\\x1b[C",
830
+ TAB: "\\t",
831
+ ESCAPE: "\\x1b",
832
+ ESC: "\\x1b",
833
+ BACKSPACE: "\\x7f"
834
+ };
835
+ const upper = text.replace(/[\s\r\n]/g, "").toUpperCase();
836
+ if (keyHints[upper]) {
837
+ console.error(`hint: "${text}" was sent as literal text. for the ${upper} key, use "${keyHints[upper]}" instead.`);
838
+ }
812
839
  const sock = socketPath(name);
813
840
  try {
814
841
  if (wait) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noninteractive",
3
- "version": "0.3.32",
3
+ "version": "0.3.34",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "noninteractive": "./bin/noninteractive.js"