You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Honestly, I'm not sure. Mainly it'll be allocating the string, so:

    var evalneed='How much is needed for eval ?';
    var cmd = `var x = E.toString(ST.read(".bootcde")); ST.eraseAll(); ST.write(".bootcde",x); console.log("survived");'
    if (x===undefined) { throw new Error("Not enough RAM for .bootcde"); }
        else {
    evalneed=''; // Required for eval
    // Ugly hack !
            eval(cmd);
           // Here i do a reset via my custom watchdog function.
    }
    

    would probably be pretty safe.

    Or... you could just do:

    eval('var x = E.toString(ST.read(".bootcde")); if (x===undefined) throw new Error("Not enough RAM for .bootcde"); ST.eraseAll(); ST.write(".bootcde",x); console.log("survived");');
    

    Which might be tidier/safer?

About

Avatar for Gordon @Gordon started