• Interrupting flow; console.handle_ctrlkey() & console.ctrlkey_passthru

    From Khelair@VERT/TINFOIL to All on Friday, November 28, 2014 15:52:12
    I was wondering if anybody familiar with the workings of console.handle_ctrlkey() and console.ctrlkey_passthru might be able to
    give me a little bit of an explanation as to the actual functionality of both of them.
    Basically, I've had the problem in debugging my current work on a JavaScript shell that infinite loops and any sort of bugs arising from improper testing for user input, etc, are requiring me to actually terminate the connection in order to recover from. For what it's worth, I've been testing this shell as an external program, just for ease of configuration, as I
    see it.
    Is there a set of options or enabling of the handlers indicated by .handle_ctrlkey() that will allow, say, the default of ^C to interrupt
    my shell completely, or to drop me back to an aforementioned function/method or other control structure within it? Sorry, I am finding the bits in http://synchro.net/docs/jsobjs.html#console a little ambiguous. :(
    Any assistance is much appreciated, as well as any meta explanation of how this is documented that I might be missing... It appears that something is missing in how I'm reading the dox, I guess. :P
    TIA

    ---
    þ Synchronet þ Tinfoil Tetrahedron BBS telnet or ssh -p 2222 to tinfoil.synchro.net
  • From Digital Man@VERT to Khelair on Friday, November 28, 2014 17:25:14
    Re: Interrupting flow; console.handle_ctrlkey() & console.ctrlkey_passthru
    By: Khelair to All on Fri Nov 28 2014 03:52 pm

    I was wondering if anybody familiar with the workings of console.handle_ctrlkey() and console.ctrlkey_passthru might be able to
    give me a little bit of an explanation as to the actual functionality of both of them.

    The ctrlkey_passthru variable allows a JS script to termporarily disable the internal control key handler for specific ctrl keys. The handl_ctrlkey() method
    allows a JS script to call into the internal control key handler to handle a specific control key (e.g. Ctrl-U to display users online).

    Basically, I've had the problem in debugging my current work on a JavaScript shell that infinite loops and any sort of bugs arising from improper testing for user input, etc, are requiring me to actually
    terminate the connection in order to recover from. For what it's worth, I've been testing this shell as an external program, just for ease of configuration, as I
    see it.
    Is there a set of options or enabling of the handlers indicated by .handle_ctrlkey() that will allow, say, the default of ^C to interrupt
    my shell completely, or to drop me back to an aforementioned
    function/method or other control structure within it? Sorry, I am finding the bits in http://synchro.net/docs/jsobjs.html#console a little ambiguous. :(
    Any assistance is much appreciated, as well as any meta explanation of how this is documented that I might be missing... It appears that
    something is missing in how I'm reading the dox, I guess. :P

    The Ctrl-C key will, by default, set the SS_ABORT flag in the bbs.sys_status variable, so if you have a loop, you can check this flag (or the console.aborted property) to terminate the loop when set.

    For example:

    while(!console.aborted) {
    // get input, do stuff
    }

    If you disable the internal control key handler for the Ctrl-C key, then this won't work without more work.

    digital man

    Synchronet "Real Fact" #50:
    Rob Swindell was introduced to BBSing in 1982 by his older brother, Dr. Seuss. Norco, CA WX: 72.5øF, 30.0% humidity, 9 mph SE wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From Khelair@VERT/TINFOIL to Digital Man on Saturday, November 29, 2014 11:21:13
    Re: Interrupting flow; console.handle_ctrlkey() & console.ctrlkey_passthru
    By: Digital Man to Khelair on Fri Nov 28 2014 17:25:14

    The Ctrl-C key will, by default, set the SS_ABORT flag in the bbs.sys_status variable, so if you have a loop, you can check this flag (or the console.aborted property) to terminate the loop when set.

    For example:

    while(!console.aborted) {
    // get input, do stuff
    }

    Cool. Precisely what I was looking for. Thank you.

    ---
    þ Synchronet þ Tinfoil Tetrahedron BBS telnet or ssh -p 2222 to tinfoil.synchro.net
  • From Digital Man@VERT/ISIS to Khelair on Friday, November 28, 2014 19:59:00
    Re: Interrupting flow; console.handle_ctrlkey() & console.ctrlkey_passthru
    By: Khelair to All on Fri Nov 28 2014 03:52 pm
    I was wondering if anybody familiar with the workings of console.handle_ctrlkey() and console.ctrlkey_passthru might be able to
    give me a little bit of an explanation as to the actual functionality of both of them.

    The ctrlkey_passthru variable allows a JS script to termporarily disablethe internal control key handler for specific ctrl keys. The handl_ctrlkey() method

    allows a JS script to call into the internal control key handler to handle a specific control key (e.g. Ctrl-U to display users online).

    Basically, I've had theproblem in debugging my current work on a JavaScript shell that infinite loops and any sort of bugs arising from impropertesting for user input, etc, are requiring me to actually
    terminate the connection in order to recover from. For what it's worth, I've been testing this shell as an external program, just for ease of configuration, as I
    see it.
    Is there a set of options or enabling of the handlers indicated by .handle_ctrlkey() that will allow, say, the default of ^C to interrupt
    my shell completely, or to drop me back to an aforementioned
    function/method or other control structure within it? Sorry, I am finding the bits in http://synchro.net/docs/jsobjs.html#console a little ambiguous. :(
    Any assistance is much appreciated, as well as any meta explanation of how this is documented that I might be missing... It appears that
    something is missing in how I'm reading the dox, I guess. :P

    The Ctrl-C key will, by default, set the SS_ABORT flag in the bbs.sys_status variable, so if you have a loop, you can check this flag (or the console.aborted property) to terminate the loop when set.

    For example:

    while(!console.aborted) {
    // get input, do stuff
    }

    If you disable the internal control key handler for the Ctrl-C key, then this won't work without more work.

    digital man

    Synchronet "Real Fact" #50:
    Rob Swindell was introduced to BBSing in 1982 by his older brother, Dr. Seuss. Norco, CA WX: 72.5øF, 30.0% h