@basthon/kernel-base 0.40.4 → 0.40.8
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/lib/kernel.js +27 -27
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
package/lib/kernel.js
CHANGED
|
@@ -237,35 +237,35 @@ export class KernelBase {
|
|
|
237
237
|
/**
|
|
238
238
|
* Internal. Code evaluation after an eval.request event.
|
|
239
239
|
*/
|
|
240
|
-
evalFromEvent(data) {
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
dataEvent.content = text;
|
|
247
|
-
that.dispatchEvent("eval.output", dataEvent);
|
|
248
|
-
};
|
|
240
|
+
async evalFromEvent(data) {
|
|
241
|
+
const stdCallback = (std) => (text) => {
|
|
242
|
+
let dataEvent = this.clone(data);
|
|
243
|
+
dataEvent.stream = std;
|
|
244
|
+
dataEvent.content = text;
|
|
245
|
+
this.dispatchEvent("eval.output", dataEvent);
|
|
249
246
|
};
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
dataEvent.execution_count = executionCount;
|
|
258
|
-
if (typeof result !== 'undefined') {
|
|
259
|
-
dataEvent.result = result;
|
|
260
|
-
}
|
|
261
|
-
that.dispatchEvent("eval.finished", dataEvent);
|
|
262
|
-
}, function (error) {
|
|
247
|
+
const outCallback = stdCallback("stdout");
|
|
248
|
+
const errCallback = stdCallback("stderr");
|
|
249
|
+
let args;
|
|
250
|
+
try {
|
|
251
|
+
args = await this.evalAsync(data.code, outCallback, errCallback, data);
|
|
252
|
+
}
|
|
253
|
+
catch (error) {
|
|
263
254
|
errCallback(error.toString());
|
|
264
|
-
|
|
255
|
+
const dataEvent = this.clone(data);
|
|
265
256
|
dataEvent.error = error;
|
|
266
|
-
dataEvent.execution_count =
|
|
267
|
-
|
|
268
|
-
|
|
257
|
+
dataEvent.execution_count = this.execution_count;
|
|
258
|
+
this.dispatchEvent("eval.error", dataEvent);
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
if (args == null)
|
|
262
|
+
return; // this should not happend
|
|
263
|
+
const result = args[0];
|
|
264
|
+
const executionCount = args[1];
|
|
265
|
+
let dataEvent = this.clone(data);
|
|
266
|
+
dataEvent.execution_count = executionCount;
|
|
267
|
+
if (result != null)
|
|
268
|
+
dataEvent.result = result;
|
|
269
|
+
this.dispatchEvent("eval.finished", dataEvent);
|
|
269
270
|
}
|
|
270
|
-
;
|
|
271
271
|
}
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.40.
|
|
1
|
+
export declare const VERSION = "0.40.8";
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.40.
|
|
1
|
+
export const VERSION = "0.40.8";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basthon/kernel-base",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.8",
|
|
4
4
|
"description": "Basthon - Base Kernel",
|
|
5
5
|
"homepage": "https://basthon.fr",
|
|
6
6
|
"bugs": {
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "6bcfcc37743982cd7ed31d94d35ec2df2588ac0b"
|
|
40
40
|
}
|