[chuck-users] Getting the status of running shreds *into* chuck

Atte André Jensen atte at email.dk
Sun Jul 8 14:49:13 EDT 2012


On 2012-07-08 20:25, Kassen wrote:
> Hey Atte,

Hey Kassen, thanks for your reply!

>> If this is not directly possible, does anyone have an idea for a hack?
>
> Shred objects have a .running() and a .done() member function. Those
> might cover your usage case?

But that won't work when adding a file to the VM, right? I'm doing 
something like

Machine.add(filename) => id;
if(id != 0){
    id => running_patterns[i].id;
    filename => running_patterns[i].filename;
    nb_running_patterns + 1 => nb_running_patterns;
}
else {
    <<<"NOT ABLE TO LOAD FILE",filename,"-----------">>>;
}

So all I have left after the file is added is it's id. What you suggest 
is working when sporking a function or other piece of code (example from 
the manual)

// spork another, store reference to new shred in offspring
     spork ~ go() => Shred @ offspring;

> Rather cludgy workaround; you could have the VM pipe its output to a
> file, then create a chuck function that would clear the file, call for
> the VM status using Std.system( "chuck --status)", then read the file.
> This would be rather slow.

That doesn't seem to work. I did a redirect of my main 
chuck-starter-scripts output to a file like this:

run holde_pkt/ > status.txt 2>&1

And some info gets into the file, however not the result of chuck ^ or 
doing Machine.status() fro the chuck code :-(

-- 
Atte

http://atte.dk   http://modlys.dk




More information about the chuck-users mailing list