brsh 3.10.2 → 3.10.3

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/test/wbt.test.js CHANGED
@@ -1541,6 +1541,47 @@ describe('WBT GNU nano WASM package (nano / nano-wasm)', () => {
1541
1541
  expect(saved).toContain('Hello from stream!');
1542
1542
  expect(saved).not.toContain('HHeelllloo');
1543
1543
  });
1544
+
1545
+ it('delivers Ctrl+C (\\x03) as raw input to nano (~ISIG) without killing nano', async () => {
1546
+ if (!NANO_WASM_BYTES) return;
1547
+ const mod = new WebAssembly.Module(NANO_WASM_BYTES);
1548
+ const exportNames = WebAssembly.Module.exports(mod).map(e => e.name);
1549
+ expect(exportNames).toContain('get_termios_lflag');
1550
+
1551
+ await run(shell, 'wbt install nano');
1552
+
1553
+ const stdoutChunks = [];
1554
+ const onData = (chunk) => stdoutChunks.push(String(chunk));
1555
+ shell.stdout.on('data', onData);
1556
+
1557
+ const cmdPromise = shell.onCommand('nano /ctrlc-test.txt');
1558
+ await new Promise(r => setTimeout(r, 80));
1559
+
1560
+ for (const ch of 'Nano raw mode') {
1561
+ shell.write(ch);
1562
+ await new Promise(r => setTimeout(r, 5));
1563
+ }
1564
+ await new Promise(r => setTimeout(r, 30));
1565
+
1566
+ // In GNU nano, Ctrl+C (\x03) shows cursor position in the status bar instead of exiting
1567
+ shell.write('\x03');
1568
+ await new Promise(r => setTimeout(r, 40));
1569
+ expect(shell.runningCommand).toBeDefined();
1570
+ expect(stdoutChunks.join('')).toMatch(/line\s+1|col\s+14/i);
1571
+
1572
+ // Save (Ctrl+O, Enter) and exit (Ctrl+X) cleanly
1573
+ shell.write('\x0f');
1574
+ await new Promise(r => setTimeout(r, 30));
1575
+ shell.write('\r');
1576
+ await new Promise(r => setTimeout(r, 30));
1577
+ shell.write('\x18');
1578
+
1579
+ await cmdPromise;
1580
+ shell.stdout.off('data', onData);
1581
+
1582
+ expect(shell.lastCode).toBe(0);
1583
+ expect(shell.context.fs.getFileByPath('/ctrlc-test.txt')).toContain('Nano raw mode');
1584
+ });
1544
1585
  });
1545
1586
 
1546
1587
  describe('WBT filesystem installer architecture (installer, not runtime)', () => {