@lvce-editor/pty-host 8.8.0 → 8.8.1

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.
@@ -1553,14 +1553,14 @@ const remove = id => {
1553
1553
  };
1554
1554
 
1555
1555
  // TODO maybe merge pty and pty controller
1556
- const create = async (ipc, id, cwd, command, args) => {
1556
+ const createWithDependencies = async (ipc, id, cwd, command, args, createPty) => {
1557
1557
  number(id);
1558
1558
  string(cwd);
1559
1559
  string(command);
1560
1560
  array(args);
1561
1561
  object(ipc);
1562
1562
  // @ts-ignore
1563
- const pty = await create$1({
1563
+ const pty = await createPty({
1564
1564
  args,
1565
1565
  command,
1566
1566
  cwd
@@ -1572,9 +1572,23 @@ const create = async (ipc, id, cwd, command, args) => {
1572
1572
  params: [id, 'handleData', event.data]
1573
1573
  });
1574
1574
  };
1575
+ const handleExit = event => {
1576
+ remove(id);
1577
+ ipc.send({
1578
+ jsonrpc: '2.0',
1579
+ method: 'Viewlet.send',
1580
+ params: [id, 'handleExit', event.data]
1581
+ });
1582
+ };
1575
1583
  pty.addEventListener('data', handleData);
1584
+ pty.addEventListener('exit', handleExit, {
1585
+ once: true
1586
+ });
1576
1587
  set(id, pty);
1577
1588
  };
1589
+ const create = (ipc, id, cwd, command, args) => {
1590
+ return createWithDependencies(ipc, id, cwd, command, args, create$1);
1591
+ };
1578
1592
  const write = (id, data) => {
1579
1593
  const pty = get(id);
1580
1594
  if (!pty) {
@@ -1592,7 +1606,7 @@ const resize = (id, columns, rows) => {
1592
1606
  const dispose = id => {
1593
1607
  const pty = get(id);
1594
1608
  if (!pty) {
1595
- throw new Error(`pty ${id} not found`);
1609
+ return;
1596
1610
  }
1597
1611
  pty.dispose();
1598
1612
  remove(id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/pty-host",
3
- "version": "8.8.0",
3
+ "version": "8.8.1",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "pty-host"