@pocketenv/cli 0.3.4 → 0.3.5

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/dist/index.js CHANGED
@@ -24,7 +24,7 @@ import * as fs from 'fs';
24
24
  import { password, editor, input } from '@inquirer/prompts';
25
25
  import sodium from 'libsodium-wrappers';
26
26
 
27
- var version = "0.3.4";
27
+ var version = "0.3.5";
28
28
 
29
29
  async function getAccessToken() {
30
30
  const tokenPath = path.join(os.homedir(), ".pocketenv", "token.json");
@@ -536,7 +536,7 @@ function detectLightTerminal() {
536
536
  if (!savedState) return false;
537
537
  const tty = fs.openSync("/dev/tty", "r+");
538
538
  try {
539
- execSync("stty raw -echo min 0 time 2 </dev/tty 2>/dev/null");
539
+ execSync("stty -icanon -echo min 0 time 2 </dev/tty 2>/dev/null");
540
540
  fs.writeSync(tty, "\x1B]11;?\x07");
541
541
  let resp = "";
542
542
  const buf = Buffer.alloc(64);
@@ -553,8 +553,14 @@ function detectLightTerminal() {
553
553
  return 0.299 * r + 0.587 * g + 0.114 * b > 127;
554
554
  }
555
555
  } finally {
556
- fs.closeSync(tty);
557
- execSync(`stty ${savedState} </dev/tty 2>/dev/null`);
556
+ try {
557
+ fs.closeSync(tty);
558
+ } catch {
559
+ }
560
+ try {
561
+ execSync(`stty ${savedState} </dev/tty 2>/dev/null`);
562
+ } catch {
563
+ }
558
564
  }
559
565
  } catch {
560
566
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "bin": {
5
5
  "pocketenv": "dist/index.js"
6
6
  },
7
- "version": "0.3.4",
7
+ "version": "0.3.5",
8
8
  "type": "module",
9
9
  "keywords": [
10
10
  "sandbox",
package/src/theme.ts CHANGED
@@ -27,7 +27,9 @@ function detectLightTerminal(): boolean {
27
27
  if (!savedState) return false;
28
28
  const tty = fs.openSync("/dev/tty", "r+");
29
29
  try {
30
- execSync("stty raw -echo min 0 time 2 </dev/tty 2>/dev/null");
30
+ // Use -icanon -echo instead of raw: avoids disabling ISIG (Ctrl+C) so
31
+ // signal handling stays intact even if the restore below fails.
32
+ execSync("stty -icanon -echo min 0 time 2 </dev/tty 2>/dev/null");
31
33
  fs.writeSync(tty, "\x1b]11;?\x07");
32
34
  // Read in a loop until we see the response terminator (BEL or ST),
33
35
  // so leftover bytes don't leak into the terminal input buffer.
@@ -47,8 +49,8 @@ function detectLightTerminal(): boolean {
47
49
  return 0.299 * r + 0.587 * g + 0.114 * b > 127;
48
50
  }
49
51
  } finally {
50
- fs.closeSync(tty);
51
- execSync(`stty ${savedState} </dev/tty 2>/dev/null`);
52
+ try { fs.closeSync(tty); } catch {}
53
+ try { execSync(`stty ${savedState} </dev/tty 2>/dev/null`); } catch {}
52
54
  }
53
55
  } catch {}
54
56
  }