pinokiod 3.19.91 → 3.19.93

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.
@@ -46,6 +46,8 @@ class Local {
46
46
  }
47
47
  }
48
48
  */
49
+
50
+
49
51
  let converted = Object.assign({}, req, {
50
52
  params: {
51
53
  local: req.params
@@ -104,6 +104,17 @@ module.exports = async (req, ondata, kernel) => {
104
104
  }
105
105
  old = await set(old, kv, kernel, req, ondata)
106
106
  kernel.memory[type][parent_id] = old
107
+
108
+ if (ondata) {
109
+ ondata({ raw: `\r\n\r\n===================================================\r\n` })
110
+ ondata({
111
+ raw: `# ${type} variables\r\n`
112
+ })
113
+ ondata({
114
+ raw: JSON.stringify(old, null, 2).replace(/\n/g, "\r\n")
115
+ })
116
+ ondata({ raw: `\r\n===================================================\r\n\r\n` })
117
+ }
107
118
 
108
119
  // if (!kernel.memory[type][req.uri]) {
109
120
  // kernel.memory[type][req.uri] = {}
package/kernel/bin/cli.js CHANGED
@@ -15,8 +15,11 @@ class CLI {
15
15
  } else {
16
16
  exists = await Util.exists(this.kernel.path("bin/npm/bin/pterm"))
17
17
  }
18
+ console.log("cli check")
19
+ console.log({exists})
18
20
  if (exists) {
19
21
  let p = this.kernel.which("pterm")
22
+ console.log({ p })
20
23
  if (p) {
21
24
  let res = await this.kernel.exec({
22
25
  message: "pterm version terminal"
@@ -25,6 +28,7 @@ class CLI {
25
28
  if (e && e.length > 0) {
26
29
  let v = e[1]
27
30
  let coerced = semver.coerce(v)
31
+ console.log({ e, v, coerced })
28
32
  if (semver.satisfies(coerced, this.version)) {
29
33
  return true
30
34
  } else {
package/kernel/index.js CHANGED
@@ -638,6 +638,7 @@ class Kernel {
638
638
  return null
639
639
  }
640
640
  } else {
641
+ console.log("which.sync", name, this.envs.PATH)
641
642
  return which.sync(name, { nothrow: true, path: this.envs.PATH })
642
643
  }
643
644
  }
package/kernel/shells.js CHANGED
@@ -92,11 +92,15 @@ class Shells {
92
92
  if (options) params.group = options.group // set group
93
93
 
94
94
  let m
95
+ let matched_index
95
96
 
96
97
  // if error doesn't exist, add default "error:" event
97
98
  if (!params.on) {
98
99
  params.on = []
99
100
  }
101
+
102
+ let monitor = structuredClone(params.on)
103
+
100
104
  // default error
101
105
  const defaultHandlers = [{
102
106
  event: "/error:/i",
@@ -132,7 +136,8 @@ class Shells {
132
136
  }
133
137
  */
134
138
  if (params.on && Array.isArray(params.on)) {
135
- for(let handler of params.on) {
139
+ for(let i=0; i<params.on.length; i++) {
140
+ let handler = params.on[i]
136
141
  // regexify
137
142
  //let matches = /^\/([^\/]+)\/([dgimsuy]*)$/.exec(handler.event)
138
143
  if (handler.event) {
@@ -167,10 +172,12 @@ class Shells {
167
172
  stream.matches = rendered_event
168
173
  if (handler.kill) {
169
174
  m = rendered_event[0]
175
+ matched_index = i
170
176
  sh.kill()
171
177
  }
172
178
  if (handler.done) {
173
179
  m = rendered_event[0]
180
+ matched_index = i
174
181
  sh.continue()
175
182
  }
176
183
  }
@@ -250,6 +257,36 @@ class Shells {
250
257
  }
251
258
 
252
259
 
260
+ if (ondata) {
261
+ if (m) {
262
+ ondata({ raw: `\r\n\r\n===================================================\r\n` })
263
+ //ondata({ raw: `# event handlers\r\n` })
264
+ //ondata({
265
+ // raw: JSON.stringify(monitor, null, 2).replace(/\n/g, "\r\n") + "\r\n\r\n"
266
+ //})
267
+ ////for(let handler of monitor) {
268
+ //// let matches = /^\/(.+)\/([dgimsuy]*)$/gs.exec(handler.event)
269
+ //// if (!/g/.test(matches[2])) {
270
+ //// matches[2] += "g" // if g option is not included, include it (need it for matchAll)
271
+ //// }
272
+ //// let re = new RegExp(matches[1], matches[2])
273
+ //// ondata({ raw: `- ${re}\r\n` })
274
+ ////}
275
+ //ondata({ raw: `# matched event handler\r\n` })
276
+ //ondata({
277
+ // raw: JSON.stringify(monitor[matched_index], null, 2).replace(/\n/g, "\r\n") + "\r\n\r\n"
278
+ //})
279
+ ondata({
280
+ raw: `# input.event\r\n`
281
+ })
282
+ ondata({
283
+ raw: JSON.stringify(m, null, 2).replace(/\n/g, "\r\n")
284
+ })
285
+ ondata({ raw: `\r\n===================================================\r\n\r\n` })
286
+ }
287
+ }
288
+
289
+
253
290
  if (errors.size > 0) {
254
291
  // try replacing the shortest pattern from the text one by one and narrow down the errors
255
292
  // so it doesn't accidently contain a very long match
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.19.91",
3
+ "version": "3.19.93",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {