pinokiod 3.8.148 → 3.8.150
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/kernel/api/index.js +0 -10
- package/kernel/api/script/index.js +0 -2
- package/kernel/bin/caddy.js +6 -9
- package/kernel/bin/conda.js +4 -9
- package/kernel/bin/index.js +213 -81
- package/kernel/bin/setup.js +130 -0
- package/kernel/environment.js +50 -1
- package/kernel/index.js +15 -60
- package/kernel/info.js +0 -3
- package/kernel/kv.js +3 -0
- package/kernel/loader.js +3 -12
- package/kernel/peer.js +11 -16
- package/kernel/procs.js +1 -4
- package/kernel/prototype.js +12 -9
- package/kernel/router/common.js +31 -41
- package/kernel/router/connector.js +33 -64
- package/kernel/router/index.js +51 -124
- package/kernel/router/localhost_home_router.js +7 -18
- package/kernel/router/localhost_variable_router.js +0 -1
- package/kernel/router/peer_port_router.js +2 -3
- package/kernel/router/processor.js +0 -3
- package/kernel/shell.js +0 -23
- package/kernel/shells.js +0 -16
- package/package.json +1 -1
- package/server/index.js +145 -318
- package/server/public/fscreator.js +1 -1
- package/server/public/install.js +2 -2
- package/server/public/style.css +4 -0
- package/server/socket.js +0 -27
- package/server/views/bootstrap.ejs +6 -1
- package/server/views/download.ejs +7 -1
- package/server/views/editor.ejs +7 -3
- package/server/views/file_explorer.ejs +7 -1
- package/server/views/index.ejs +7 -1
- package/server/views/install.ejs +8 -5
- package/server/views/minterm.ejs +7 -3
- package/server/views/network.ejs +3 -1
- package/server/views/prototypes.ejs +1 -1
- package/server/views/setup.ejs +254 -0
- package/server/views/setup_home.ejs +181 -0
- package/server/views/terminal.ejs +7 -4
- package/kernel/caddy2.js +0 -666
- package/kernel/peer2.js +0 -83
- package/kernel/router/root.js +0 -54
- package/kernel/tree-kill.js +0 -167
package/kernel/router/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const axios = require('axios')
|
|
2
2
|
const path = require('path')
|
|
3
|
+
const { glob, sync, hasMagic } = require('glob-gitignore')
|
|
3
4
|
const Util = require('../util')
|
|
4
5
|
const LocalhostHomeRouter = require('./localhost_home_router')
|
|
5
6
|
const LocalhostVariableRouter = require('./localhost_variable_router')
|
|
@@ -28,6 +29,45 @@ class Router {
|
|
|
28
29
|
this.mapping = {}
|
|
29
30
|
this.port_mapping = {} // 127.0.0.1 => 192.168,..
|
|
30
31
|
this.local_network_mapping = {}
|
|
32
|
+
this.custom_routers = {}
|
|
33
|
+
}
|
|
34
|
+
async init() {
|
|
35
|
+
console.log("router.init")
|
|
36
|
+
// if ~/pinokio/network doesn't exist, clone
|
|
37
|
+
let exists = await this.kernel.exists("network/system")
|
|
38
|
+
if (!exists) {
|
|
39
|
+
console.log("network doesn't exist. cloning...")
|
|
40
|
+
await fs.promises.mkdir(this.kernel.path("network"), { recursive: true }).catch((e) => { })
|
|
41
|
+
await this.kernel.exec({
|
|
42
|
+
message: "git clone https://github.com/peanutcocktail/network system",
|
|
43
|
+
path: this.kernel.path("network")
|
|
44
|
+
}, (e) => {
|
|
45
|
+
process.stdout.write(e.raw)
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
let cwd = path.resolve(this.kernel.homedir, "network")
|
|
51
|
+
let router_paths = (await glob('**/*.json', { cwd }))
|
|
52
|
+
let router_dir = path.resolve(this.kernel.homedir, "network")
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
// create a custom_map that maps port to custom router declarations
|
|
56
|
+
/*
|
|
57
|
+
custom_routers = {
|
|
58
|
+
PORT1: <caddy handler>,
|
|
59
|
+
PORT2: <caddy handler>,
|
|
60
|
+
...
|
|
61
|
+
}
|
|
62
|
+
*/
|
|
63
|
+
this.custom_routers = {}
|
|
64
|
+
for(let router_path of router_paths) {
|
|
65
|
+
let router_abs_path = this.kernel.path("network", router_path)
|
|
66
|
+
let config = await this.kernel.require(router_abs_path)
|
|
67
|
+
for(let port in config) {
|
|
68
|
+
this.custom_routers[port] = config[port]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
31
71
|
}
|
|
32
72
|
async add({ host, match, dial }) {
|
|
33
73
|
if (!this._mapping[host]) {
|
|
@@ -49,8 +89,6 @@ class Router {
|
|
|
49
89
|
mapping[host][url] = Array.from(internal_maps[url])
|
|
50
90
|
}
|
|
51
91
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
92
|
let host_mapping = mapping[this.kernel.peer.host]
|
|
55
93
|
if (host_mapping) {
|
|
56
94
|
for(let key in host_mapping) {
|
|
@@ -59,36 +97,13 @@ class Router {
|
|
|
59
97
|
let transformed = key.replace(":" + cache_key, '')
|
|
60
98
|
let port = this.port_cache[cache_key]
|
|
61
99
|
host_mapping[transformed + ":" + port] = host_mapping[key]
|
|
62
|
-
// console.log("replacing", transformed + ":" + port, "with", host_mapping[key])
|
|
63
100
|
delete host_mapping[key]
|
|
64
101
|
}
|
|
65
102
|
}
|
|
66
103
|
}
|
|
67
104
|
mapping[this.kernel.peer.host] = host_mapping
|
|
68
|
-
// let json = JSON.stringify(host_mapping)
|
|
69
|
-
// for(let key in this.port_cache) {
|
|
70
|
-
// console.log("replacing", key, "with", this.port_cache[key])
|
|
71
|
-
// json = json.replaceAll(key, this.port_cache[key])
|
|
72
|
-
// }
|
|
73
|
-
// console.log("json", json)
|
|
74
|
-
// let m = JSON.parse(json)
|
|
75
|
-
//
|
|
76
|
-
// mapping[this.kernel.peer.host] = m
|
|
77
|
-
// console.log("AFTER REPLACING", mapping)
|
|
78
105
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
106
|
return mapping
|
|
82
|
-
|
|
83
|
-
// let json = JSON.stringify(mapping)
|
|
84
|
-
// for(let key in this.port_cache) {
|
|
85
|
-
// console.log("replacing", key, "with", this.port_cache[key])
|
|
86
|
-
// json = json.replaceAll(key, this.port_cache[key])
|
|
87
|
-
// }
|
|
88
|
-
// let m = JSON.parse(json)
|
|
89
|
-
//
|
|
90
|
-
// console.log("AFTER REPLACING", m)
|
|
91
|
-
// return m
|
|
92
107
|
}
|
|
93
108
|
/*
|
|
94
109
|
returns only the published peer info
|
|
@@ -105,17 +120,12 @@ class Router {
|
|
|
105
120
|
*/
|
|
106
121
|
published() {
|
|
107
122
|
let pub = {}
|
|
108
|
-
// console.log("published info", this.info)
|
|
109
123
|
if (this.info) {
|
|
110
124
|
let routes = this.info[this.kernel.peer.host]
|
|
111
125
|
for(let dial in routes) {
|
|
112
126
|
let matches = routes[dial]
|
|
113
|
-
|
|
114
|
-
// if (dial.startsWith(this.kernel.peer.host)) {
|
|
115
|
-
pub[dial] = matches
|
|
116
|
-
// }
|
|
127
|
+
pub[dial] = matches
|
|
117
128
|
}
|
|
118
|
-
// console.log({ pub })
|
|
119
129
|
}
|
|
120
130
|
return pub
|
|
121
131
|
}
|
|
@@ -124,27 +134,9 @@ class Router {
|
|
|
124
134
|
// find all PORT_PLACEHOLDER patterns
|
|
125
135
|
const matches = jsonString.match(/:PORT_PLACEHOLDER_[0-9.:]+/g)
|
|
126
136
|
|
|
127
|
-
|
|
128
137
|
// iterate through them and see if the port already exists
|
|
129
138
|
let count = matches ? new Set(matches).size : 0
|
|
130
|
-
//console.log("fill matches", { matches, count })
|
|
131
|
-
/*
|
|
132
|
-
let count = 0
|
|
133
|
-
if (matches) {
|
|
134
|
-
for(let match of matches) {
|
|
135
|
-
console.log("testing", match)
|
|
136
|
-
const port_match = match.match(/[0-9.]+:([0-9]+)/);
|
|
137
|
-
let port = port_match ? port_match[1] : null
|
|
138
|
-
console.log({ port, port_match })
|
|
139
|
-
if (port && !this.port_mapping[port]) {
|
|
140
|
-
count++
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
*/
|
|
145
|
-
|
|
146
139
|
let new_config
|
|
147
|
-
|
|
148
140
|
if (count > 0) {
|
|
149
141
|
let ports = await this.kernel.ports(count)
|
|
150
142
|
let response = Util.fill_object(this.config, /PORT_PLACEHOLDER_.+/, ports, this.port_cache)
|
|
@@ -156,36 +148,27 @@ class Router {
|
|
|
156
148
|
let chunks = local_share_key.split(":")
|
|
157
149
|
let original_port = chunks[chunks.length-1]
|
|
158
150
|
let local_share_ip = chunks.slice(0, chunks.length-1).join(":")
|
|
159
|
-
|
|
160
151
|
let local_share_port = replaced_map[key]
|
|
161
152
|
if (!this.local_network_mapping[local_share_ip]) {
|
|
162
153
|
this.local_network_mapping[local_share_ip] = {}
|
|
163
154
|
}
|
|
164
155
|
this.local_network_mapping[local_share_ip][original_port] = local_share_port
|
|
165
|
-
|
|
166
|
-
|
|
167
156
|
//let original_port = key.replace("PORT_PLACEHOLDER_", "")
|
|
168
157
|
this.port_mapping[original_port] = replaced_map[key]
|
|
169
|
-
// console.log("set port_mapping", { original_port, key, replaced_map })
|
|
170
158
|
}
|
|
171
159
|
this.port_cache = replaced_map
|
|
172
160
|
}
|
|
173
|
-
|
|
174
161
|
}
|
|
175
162
|
|
|
176
163
|
|
|
177
164
|
// set local config
|
|
178
165
|
async local() {
|
|
179
166
|
this._mapping = {}
|
|
180
|
-
// this._tree = {}
|
|
181
167
|
this.localhost_home_router.handle()
|
|
182
168
|
this.localhost_variable_router.handle(this.kernel.memory.local)
|
|
183
169
|
for(let proc of this.kernel.processes.info) {
|
|
184
170
|
this.localhost_port_router.handle(proc)
|
|
185
171
|
}
|
|
186
|
-
//this.mapping = this._mapping
|
|
187
|
-
|
|
188
|
-
|
|
189
172
|
for(let host in this.kernel.peer.info) {
|
|
190
173
|
let peer = this.kernel.peer.info[host]
|
|
191
174
|
if (peer.host === this.kernel.peer.host) {
|
|
@@ -196,7 +179,6 @@ class Router {
|
|
|
196
179
|
}
|
|
197
180
|
await this.fill()
|
|
198
181
|
this.mapping = this._mapping
|
|
199
|
-
// this.tree = this._tree
|
|
200
182
|
}
|
|
201
183
|
|
|
202
184
|
// set remote config
|
|
@@ -209,9 +191,7 @@ class Router {
|
|
|
209
191
|
}
|
|
210
192
|
//await this.fill()
|
|
211
193
|
this.mapping = this._mapping
|
|
212
|
-
// this.tree = this._tree
|
|
213
194
|
this.info = this._info()
|
|
214
|
-
// console.log("TREE", JSON.stringify(this.tree, null, 2))
|
|
215
195
|
}
|
|
216
196
|
|
|
217
197
|
// update caddy config
|
|
@@ -219,70 +199,17 @@ class Router {
|
|
|
219
199
|
if (JSON.stringify(this.config) === JSON.stringify(this.old_config)) {
|
|
220
200
|
// console.log("config hasn't updated")
|
|
221
201
|
} else {
|
|
222
|
-
console.log("caddy config has updated")
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
202
|
+
console.log("caddy config has updated", this.config)
|
|
203
|
+
try {
|
|
204
|
+
let response = await axios.post('http://127.0.0.1:2019/load', this.config, {
|
|
205
|
+
headers: { 'Content-Type': 'application/json' }
|
|
206
|
+
})
|
|
207
|
+
console.log("Caddy Response", { response })
|
|
208
|
+
this.old_config = this.config
|
|
209
|
+
} catch (e) {
|
|
210
|
+
console.log("EEEEEEEEEEEEE", e)
|
|
211
|
+
}
|
|
230
212
|
}
|
|
231
213
|
}
|
|
232
|
-
|
|
233
|
-
// async refresh() {
|
|
234
|
-
//// console.log("router.refresh")
|
|
235
|
-
//// console.time("router.refresh")
|
|
236
|
-
//// console.log("> procs", this.kernel.processes.info)
|
|
237
|
-
//// console.log("> peers", this.kernel.peer.info)
|
|
238
|
-
// this._mapping = {}
|
|
239
|
-
//// this.port_mapping = {} // 127.0.0.1 => 192.168,..
|
|
240
|
-
//// this.local_network_mapping = {}
|
|
241
|
-
//
|
|
242
|
-
// let old_config = this.config
|
|
243
|
-
//
|
|
244
|
-
// // 1. Localhost handling
|
|
245
|
-
// this.localhost_home_router.handle()
|
|
246
|
-
// this.localhost_variable_router.handle(this.kernel.memory.local)
|
|
247
|
-
// for(let proc of this.kernel.processes.info) {
|
|
248
|
-
// this.localhost_port_router.handle(proc)
|
|
249
|
-
// }
|
|
250
|
-
// this.mapping = this._mapping
|
|
251
|
-
//
|
|
252
|
-
// // 2. Peers handling
|
|
253
|
-
// for(let host in this.kernel.peer.info) {
|
|
254
|
-
// let peer = this.kernel.peer.info[host]
|
|
255
|
-
// if (peer.host === this.kernel.peer.host) {
|
|
256
|
-
// this.peer_home_router.handle(peer)
|
|
257
|
-
// this.peer_variable_router.handle(peer)
|
|
258
|
-
// this.peer_port_router.handle(peer)
|
|
259
|
-
// } else {
|
|
260
|
-
// this.peer_peer_router.handle(peer)
|
|
261
|
-
// }
|
|
262
|
-
// }
|
|
263
|
-
// // replace :PORT_PLACEHOLDER with available ports
|
|
264
|
-
//
|
|
265
|
-
//
|
|
266
|
-
// await this.fill()
|
|
267
|
-
// this.mapping = this._mapping
|
|
268
|
-
// console.timeEnd("router.refresh")
|
|
269
|
-
//
|
|
270
|
-
//
|
|
271
|
-
// // compare old config with new config
|
|
272
|
-
// // if it hasn't changed, don't do anything
|
|
273
|
-
// // if it has changed, refresh
|
|
274
|
-
//
|
|
275
|
-
// if (JSON.stringify(this.config) === JSON.stringify(old_config)) {
|
|
276
|
-
// console.log("config hasn't updated")
|
|
277
|
-
// } else {
|
|
278
|
-
// console.log("config has updated")
|
|
279
|
-
// let response = await axios.post('http://127.0.0.1:2019/load', this.config, {
|
|
280
|
-
// headers: { 'Content-Type': 'application/json' }
|
|
281
|
-
// }).catch((e) => {
|
|
282
|
-
// console.log("EEEEEEEEEEEEE", e.message)
|
|
283
|
-
// })
|
|
284
|
-
// console.log("Caddy Response", { response })
|
|
285
|
-
// }
|
|
286
|
-
// }
|
|
287
214
|
}
|
|
288
215
|
module.exports = Router
|
|
@@ -54,23 +54,6 @@ class LocalhostHomeRouter {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
|
-
//{
|
|
58
|
-
// "handler": "headers",
|
|
59
|
-
// "request": {
|
|
60
|
-
// "set": {
|
|
61
|
-
// "X-Forwarded-Proto": ["https"],
|
|
62
|
-
// "X-Forwarded-Host": ["{http.request.host}"]
|
|
63
|
-
// }
|
|
64
|
-
// },
|
|
65
|
-
// "response": {
|
|
66
|
-
// "set": {
|
|
67
|
-
// "Access-Control-Allow-Origin": ["*"],
|
|
68
|
-
// "Access-Control-Allow-Methods": ["GET, POST, OPTIONS, PUT, DELETE"],
|
|
69
|
-
// "Access-Control-Allow-Headers": ["*"],
|
|
70
|
-
// "Vary": ["Origin"]
|
|
71
|
-
// }
|
|
72
|
-
// }
|
|
73
|
-
//}
|
|
74
57
|
]
|
|
75
58
|
},
|
|
76
59
|
]
|
|
@@ -83,7 +66,13 @@ class LocalhostHomeRouter {
|
|
|
83
66
|
"default": {
|
|
84
67
|
"writer": {
|
|
85
68
|
"output": "file",
|
|
86
|
-
"filename": this.router.kernel.path("logs/caddy.log")
|
|
69
|
+
"filename": this.router.kernel.path("logs/caddy.log"),
|
|
70
|
+
"roll": true,
|
|
71
|
+
"roll_size_mb": 1,
|
|
72
|
+
"roll_keep": 1,
|
|
73
|
+
"roll_keep_days": 1,
|
|
74
|
+
"roll_gzip": false,
|
|
75
|
+
"roll_local_time": true
|
|
87
76
|
},
|
|
88
77
|
"level": "INFO"
|
|
89
78
|
}
|
|
@@ -15,7 +15,6 @@ class LocalhostVariableRouter extends Processor {
|
|
|
15
15
|
if (val.startsWith("http")) {
|
|
16
16
|
let dial = val.replace(/https?:\/\//, '')
|
|
17
17
|
let name = this.api_name(this.router.kernel.platform, this.router.kernel.homedir, script_path)
|
|
18
|
-
console.log({ dial, name, has_port: this.has_port(dial), parsed_dial: this.parse_ip(dial) })
|
|
19
18
|
if (this.has_port(dial)) {
|
|
20
19
|
if (key === "url") {
|
|
21
20
|
this.common.handle({
|
|
@@ -9,9 +9,10 @@ class PeerPortRouter extends Processor {
|
|
|
9
9
|
}
|
|
10
10
|
handle(peer) {
|
|
11
11
|
let https_domains_mapping = this.router.info[peer.host]
|
|
12
|
+
console.log({ https_domains_mapping })
|
|
12
13
|
for(let dial in https_domains_mapping) {
|
|
14
|
+
console.log({ dial })
|
|
13
15
|
let parsed_dial = this.parse_ip(dial)
|
|
14
|
-
|
|
15
16
|
if (parsed_dial.host !== peer.host) {
|
|
16
17
|
// ONLY connect for 127.0.0.1 or localhost
|
|
17
18
|
// DO NOT connect if it's the actual host => because it will keep creating proxies forever recursively. only need to create proxies for localhost
|
|
@@ -40,8 +41,6 @@ class PeerPortRouter extends Processor {
|
|
|
40
41
|
})
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
}
|
|
@@ -5,7 +5,6 @@ class Processor {
|
|
|
5
5
|
return chunks.length === 2
|
|
6
6
|
}
|
|
7
7
|
api_name(platform, home, str) {
|
|
8
|
-
console.log({ platform, home, str })
|
|
9
8
|
let api_path
|
|
10
9
|
let rel_path
|
|
11
10
|
let name
|
|
@@ -19,9 +18,7 @@ class Processor {
|
|
|
19
18
|
api_path = _path.resolve(home, "api")
|
|
20
19
|
rel_path = _path.relative(api_path, str)
|
|
21
20
|
}
|
|
22
|
-
console.log({ api_path, rel_path, })
|
|
23
21
|
name = rel_path.split(_path.sep)[0]
|
|
24
|
-
console.log({ name })
|
|
25
22
|
return name
|
|
26
23
|
}
|
|
27
24
|
parse_ip(str) {
|
package/kernel/shell.js
CHANGED
|
@@ -2,7 +2,6 @@ const { Terminal } = require('xterm-headless');
|
|
|
2
2
|
const { SerializeAddon } = require("xterm-addon-serialize");
|
|
3
3
|
const sanitize = require("sanitize-filename");
|
|
4
4
|
const YAML = require('yaml')
|
|
5
|
-
//const kill = require('./tree-kill');
|
|
6
5
|
const kill = require('kill-sync')
|
|
7
6
|
const fastq = require('fastq')
|
|
8
7
|
const { v4: uuidv4 } = require('uuid');
|
|
@@ -988,18 +987,6 @@ class Shell {
|
|
|
988
987
|
this.ondata({ raw: `\r\n\r\n██ Terminated Shell ${this.id}\r\n████\r\n` })
|
|
989
988
|
console.log("before cb 1")
|
|
990
989
|
cb()
|
|
991
|
-
|
|
992
|
-
// let map = this.kernel.processes.map || {}
|
|
993
|
-
// kill(this.ptyProcess.pid, map, 'SIGKILL', () => {
|
|
994
|
-
// console.log("child procs killed for", this.ptyProcess.pid)
|
|
995
|
-
// this.ptyProcess.kill()
|
|
996
|
-
// this.ptyProcess = undefined
|
|
997
|
-
// // automatically remove the shell from this.kernel.shells
|
|
998
|
-
// this.kernel.shell.rm(this.id)
|
|
999
|
-
// this.ondata({ raw: `\r\n\r\n██ Terminated Shell ${this.id}\r\n████\r\n` })
|
|
1000
|
-
// console.log("before cb 1")
|
|
1001
|
-
// cb()
|
|
1002
|
-
// });
|
|
1003
990
|
} else {
|
|
1004
991
|
kill(this.ptyProcess.pid, "SIGKILL", true)
|
|
1005
992
|
this.ptyProcess.kill()
|
|
@@ -1007,18 +994,8 @@ class Shell {
|
|
|
1007
994
|
// automatically remove the shell from this.kernel.shells
|
|
1008
995
|
this.kernel.shell.rm(this.id)
|
|
1009
996
|
this.ondata({ raw: `\r\n\r\n██ Terminated Shell ${this.id}\r\n████\r\n` })
|
|
1010
|
-
|
|
1011
|
-
// let map = this.kernel.processes.map || {}
|
|
1012
|
-
// kill(this.ptyProcess.pid, map, 'SIGKILL');
|
|
1013
|
-
// console.log("child procs killed for", this.ptyProcess.pid)
|
|
1014
|
-
// this.ptyProcess.kill()
|
|
1015
|
-
// this.ptyProcess = undefined
|
|
1016
|
-
// // automatically remove the shell from this.kernel.shells
|
|
1017
|
-
// this.kernel.shell.rm(this.id)
|
|
1018
|
-
// this.ondata({ raw: `\r\n\r\n██ Terminated Shell ${this.id}\r\n████\r\n` })
|
|
1019
997
|
}
|
|
1020
998
|
} else {
|
|
1021
|
-
// // automatically remove the shell from this.kernel.shells
|
|
1022
999
|
this.kernel.shell.rm(this.id)
|
|
1023
1000
|
this.ondata({ raw: `\r\n\r\n██ Terminated Shell ${this.id}\r\n████\r\n` })
|
|
1024
1001
|
}
|
package/kernel/shells.js
CHANGED
|
@@ -35,20 +35,9 @@ class Shells {
|
|
|
35
35
|
} else {
|
|
36
36
|
m = "ls"
|
|
37
37
|
}
|
|
38
|
-
console.time("init_env")
|
|
39
38
|
await sh.init_env({
|
|
40
39
|
env: this.kernel.bin.envs({}),
|
|
41
40
|
})
|
|
42
|
-
console.timeEnd("init_env")
|
|
43
|
-
// let response = await sh.start({
|
|
44
|
-
// message: m,
|
|
45
|
-
// env: this.kernel.bin.envs({}),
|
|
46
|
-
// conda: {
|
|
47
|
-
// skip: true
|
|
48
|
-
// }
|
|
49
|
-
// }, async (stream) => {
|
|
50
|
-
// process.stdout.write(stream.raw)
|
|
51
|
-
// })
|
|
52
41
|
|
|
53
42
|
this.kernel.envs = sh.env
|
|
54
43
|
// also set the uppercase variables if they're not set
|
|
@@ -157,9 +146,6 @@ class Shells {
|
|
|
157
146
|
}
|
|
158
147
|
ondata(stream)
|
|
159
148
|
})
|
|
160
|
-
console.log("SHELL RESPONSE", response)
|
|
161
|
-
|
|
162
|
-
|
|
163
149
|
/*
|
|
164
150
|
{
|
|
165
151
|
method: "shell.run",
|
|
@@ -246,12 +232,10 @@ class Shells {
|
|
|
246
232
|
line = line.replaceAll(err, "")
|
|
247
233
|
}
|
|
248
234
|
}
|
|
249
|
-
console.log("BEFORE SHELL RETURN 1")
|
|
250
235
|
|
|
251
236
|
// don't return if there's an error
|
|
252
237
|
return { id: sh.id, response, stdout: response, event: m, error: shortened_errs }
|
|
253
238
|
} else {
|
|
254
|
-
console.log("BEFORE SHELL RETURN 2")
|
|
255
239
|
// need to make a request
|
|
256
240
|
return { id: sh.id, response, stdout: response, event: m }
|
|
257
241
|
}
|