tio icon indicating copy to clipboard operation
tio copied to clipboard

script-run always does not seem to work as expected (v3.8)

Open herr-werner opened this issue 10 months ago • 1 comments

Using a simple script to auto-respond to a device doesn't appear to have different behavior between "always" and "once". In either setting, the script will only run the first time tio is connected, and not again if the same expect statement is in the device output. Not entirely sure this is the expected behavior.

script-run = always
script = expect('console>'); write('prodtest enter 0\\r');

is functionally equivalent to

script-run = once
script = expect('console>'); write('prodtest enter 0\\r');

where the write happens only once.

herr-werner avatar Mar 06 '25 15:03 herr-werner

From the tio man page:

       --script-run once|always|never

              Run script on connect once, always, or never.

              Default value is "always".

Perhaps it is not clear enough but this means that the script is run only on the first connect (once) or every connect (always).

In your case, to react repeatedly on a specific string, you would have to call expect repeatedly. Since it is lua, you could do that in a loop etc.

lundmar avatar Mar 06 '25 16:03 lundmar