@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.
- package/dist/ptyHostMain.js +17 -3
- package/package.json +1 -1
package/dist/ptyHostMain.js
CHANGED
|
@@ -1553,14 +1553,14 @@ const remove = id => {
|
|
|
1553
1553
|
};
|
|
1554
1554
|
|
|
1555
1555
|
// TODO maybe merge pty and pty controller
|
|
1556
|
-
const
|
|
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
|
|
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
|
-
|
|
1609
|
+
return;
|
|
1596
1610
|
}
|
|
1597
1611
|
pty.dispose();
|
|
1598
1612
|
remove(id);
|