mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 15:31:42 +00:00
Update testloader.js
This commit is contained in:
parent
7f9840f765
commit
f0504e12ec
|
@ -889,23 +889,31 @@ var test_implements = {
|
|||
|
||||
"sharedmemory_listener": function() {
|
||||
var Toolkit = require("lib/toolkit");
|
||||
var mem;
|
||||
var memName = Toolkit.prompt("Input the shared memory name");
|
||||
var targets = (function() {
|
||||
var s = Toolkit.prompt("Input the shared memory names (Comma seperated)");
|
||||
return s.split(',');
|
||||
})();
|
||||
|
||||
if (!memName) {
|
||||
if (!targets) {
|
||||
console.log("Aborted.");
|
||||
} else {
|
||||
// Open the shared memory
|
||||
mem = new Toolkit.NamedSharedMemory(memName);
|
||||
var memories = targets.map(function(x) {
|
||||
return [x, new Toolkit.NamedSharedMemory(x)];
|
||||
});
|
||||
|
||||
// Open the second process will be communicate
|
||||
Toolkit.openProcess();
|
||||
|
||||
// Listen the shared memory
|
||||
console.log("Listening the shared memory:", memName);
|
||||
console.log("Listening the shared memory:", targets.join(', '));
|
||||
while (true) {
|
||||
var message = mem.readText(memName);
|
||||
console.log(memName + ": ", message);
|
||||
console.log(new Date().toISOString());
|
||||
memories.forEach(function(x) {
|
||||
var name = x[0];
|
||||
var mem = x[1];
|
||||
console.log(name + ": ", mem.readText());
|
||||
});
|
||||
sleep(100);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user