@lvce-editor/pty-host 5.1.0 → 5.3.0
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 +9 -7
- package/package.json +1 -2
package/dist/ptyHostMain.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import debugModule from 'debug';
|
|
2
|
-
import { spawn } from 'node-pty';
|
|
3
2
|
import { Console } from 'node:console';
|
|
4
3
|
import { createWriteStream, readFileSync } from 'node:fs';
|
|
5
4
|
import { tmpdir } from 'node:os';
|
|
@@ -466,7 +465,7 @@ const listen$a = () => {
|
|
|
466
465
|
parentPort
|
|
467
466
|
} = process;
|
|
468
467
|
if (!parentPort) {
|
|
469
|
-
throw new
|
|
468
|
+
throw new IpcError('parent port must be defined');
|
|
470
469
|
}
|
|
471
470
|
return parentPort;
|
|
472
471
|
};
|
|
@@ -524,7 +523,7 @@ const getTransferrablesNode = value => {
|
|
|
524
523
|
};
|
|
525
524
|
const listen$5 = async () => {
|
|
526
525
|
if (!process.send) {
|
|
527
|
-
throw new
|
|
526
|
+
throw new IpcError('process.send must be defined');
|
|
528
527
|
}
|
|
529
528
|
return process;
|
|
530
529
|
};
|
|
@@ -1363,9 +1362,9 @@ class Pty extends EventTarget {
|
|
|
1363
1362
|
/**
|
|
1364
1363
|
*
|
|
1365
1364
|
* @param {*} param0
|
|
1366
|
-
* @returns {any}
|
|
1365
|
+
* @returns {Promise<any>}
|
|
1367
1366
|
*/
|
|
1368
|
-
const create$1 = ({
|
|
1367
|
+
const create$1 = async ({
|
|
1369
1368
|
cwd,
|
|
1370
1369
|
command,
|
|
1371
1370
|
args
|
|
@@ -1374,6 +1373,9 @@ const create$1 = ({
|
|
|
1374
1373
|
string(cwd);
|
|
1375
1374
|
string(command);
|
|
1376
1375
|
array(args);
|
|
1376
|
+
const {
|
|
1377
|
+
spawn
|
|
1378
|
+
} = await import('node-pty');
|
|
1377
1379
|
const pty = spawn(command, args, {
|
|
1378
1380
|
encoding: null,
|
|
1379
1381
|
cwd
|
|
@@ -1401,7 +1403,7 @@ const remove = id => {
|
|
|
1401
1403
|
};
|
|
1402
1404
|
|
|
1403
1405
|
// TODO maybe merge pty and pty controller
|
|
1404
|
-
const create = (ipc, id, cwd, command, args) => {
|
|
1406
|
+
const create = async (ipc, id, cwd, command, args) => {
|
|
1405
1407
|
number(id);
|
|
1406
1408
|
string(cwd);
|
|
1407
1409
|
string(command);
|
|
@@ -1409,7 +1411,7 @@ const create = (ipc, id, cwd, command, args) => {
|
|
|
1409
1411
|
object(ipc);
|
|
1410
1412
|
debug(`create ${id} ${cwd}`);
|
|
1411
1413
|
// @ts-ignore
|
|
1412
|
-
const pty = create$1({
|
|
1414
|
+
const pty = await create$1({
|
|
1413
1415
|
cwd,
|
|
1414
1416
|
command,
|
|
1415
1417
|
args
|