@lvce-editor/pty-host 0.15.18 → 0.15.20
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/package.json
CHANGED
|
@@ -1,26 +1,13 @@
|
|
|
1
1
|
import { spawn } from 'node-pty'
|
|
2
|
-
import * as Platform from '../Platform/Platform.js'
|
|
3
|
-
import * as Assert from '../Assert/Assert.js'
|
|
4
2
|
import VError from 'verror'
|
|
3
|
+
import * as Assert from '../Assert/Assert.js'
|
|
5
4
|
|
|
6
|
-
const
|
|
7
|
-
if (Platform.isWindows) {
|
|
8
|
-
return {
|
|
9
|
-
command: 'powershell.exe',
|
|
10
|
-
args: [],
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return {
|
|
14
|
-
command: 'bash',
|
|
15
|
-
args: ['-i'],
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const create = ({ env = {}, cwd } = {}) => {
|
|
5
|
+
export const create = ({ env = {}, cwd, command, args } = {}) => {
|
|
20
6
|
try {
|
|
21
7
|
Assert.string(cwd)
|
|
22
|
-
|
|
23
|
-
|
|
8
|
+
Assert.string(command)
|
|
9
|
+
Assert.array(args)
|
|
10
|
+
const pty = spawn(command, args, {
|
|
24
11
|
encoding: null,
|
|
25
12
|
cwd,
|
|
26
13
|
// cols: 10,
|
|
@@ -7,12 +7,14 @@ export const state = {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
// TODO maybe merge pty and pty controller
|
|
10
|
-
export const create = (id, cwd, ipc) => {
|
|
10
|
+
export const create = (id, cwd, command, args, ipc) => {
|
|
11
11
|
Assert.number(id)
|
|
12
12
|
Assert.string(cwd)
|
|
13
|
+
Assert.string(command)
|
|
14
|
+
Assert.array(args)
|
|
13
15
|
Assert.object(ipc)
|
|
14
16
|
Debug.debug(`create ${id} ${cwd}`)
|
|
15
|
-
const pty = Pty.create({ cwd })
|
|
17
|
+
const pty = Pty.create({ cwd, command, args })
|
|
16
18
|
const handleData = (data) => {
|
|
17
19
|
ipc.send({
|
|
18
20
|
jsonrpc: '2.0',
|