pinokiod 2.15.44 → 2.15.46
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 +1 -0
- package/kernel/shells.js +36 -0
- package/package.json +1 -1
package/kernel/api/index.js
CHANGED
package/kernel/shells.js
CHANGED
|
@@ -53,6 +53,40 @@ class Shells {
|
|
|
53
53
|
|
|
54
54
|
}
|
|
55
55
|
async launch(params, options, ondata) {
|
|
56
|
+
// if array, duplicate the action
|
|
57
|
+
if (Array.isArray(params.message)) {
|
|
58
|
+
let res
|
|
59
|
+
console.log("Message Array", params.message)
|
|
60
|
+
for(let i=0; i<params.message.length; i++) {
|
|
61
|
+
let message = params.message[i]
|
|
62
|
+
let params_dup = Object.assign({}, params)
|
|
63
|
+
params_dup.message = message
|
|
64
|
+
console.log("Launching Message", params_dup)
|
|
65
|
+
res = await this._launch(params_dup, options, ondata)
|
|
66
|
+
// if there's an error, trigger an error event
|
|
67
|
+
if (res.error) {
|
|
68
|
+
console.log("Error exists. Trigger an error", { res })
|
|
69
|
+
ondata({
|
|
70
|
+
id: res.id,
|
|
71
|
+
type: "error",
|
|
72
|
+
data: res.response,
|
|
73
|
+
event: res.error,
|
|
74
|
+
// rpc,
|
|
75
|
+
// rawrpc
|
|
76
|
+
})
|
|
77
|
+
// if there's an error, return immediately => so it will NOT go forward and stop the script
|
|
78
|
+
return res
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
console.log("Launch Message Array Finished", res)
|
|
82
|
+
return res
|
|
83
|
+
} else {
|
|
84
|
+
console.log("Single Message", params.message)
|
|
85
|
+
let res = await this._launch(params, options, ondata)
|
|
86
|
+
return res
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async _launch(params, options, ondata) {
|
|
56
90
|
// iterate through all the envs
|
|
57
91
|
params.env = this.kernel.bin.envs(params.env)
|
|
58
92
|
|
|
@@ -126,6 +160,8 @@ class Shells {
|
|
|
126
160
|
ondata(stream)
|
|
127
161
|
})
|
|
128
162
|
|
|
163
|
+
console.log(">>>>>> RESPONSE", response)
|
|
164
|
+
|
|
129
165
|
/*
|
|
130
166
|
{
|
|
131
167
|
method: "shell.run",
|