script-server icon indicating copy to clipboard operation
script-server copied to clipboard

Slow execution of multiline commands

Open raszuk opened this issue 1 year ago • 3 comments

Hi,

When I am passing as argument to the script a multiline command with "\" to indicate cont

root@pe1-isis-bbix(config-alias-sh-ip-int)# expansion "show interface | select subinterface * ipv4 address state ip | select admin-status \

| select oper-status | select counters in-bits-rate-brief | select counters out-bits-rate-brief \ | select counters in-discards | select counters in-errors | select counters out-discards \ | select counters out-errors | inc [swp,eth]"

at every such line "your input >>" appears and script server is waiting for input ... At each line a time out needs to fire to proceed to subsequent line of such multiline command.

Is there some easy workaround possible here - skipping such wait all together or shortening the input timeout ?

Thx !

raszuk avatar Aug 19 '23 23:08 raszuk

Hi @raszuk, to be honest, I don't know this syntax and commands. Do you put this command directly into json? Could you try using a bash script for it?

bugy avatar Aug 20 '23 13:08 bugy

I think what happens here is that Script Server whenever it sees a response starting with "> " is triggering a user input prompt ... And that is very cool in general - except here when > is really not indication of user input but prompt to enter new line of multiline command.

I am talking about commands which are read from file or input as text box.

Of course if I do not break the long line with "\" all works fine but this is a bit annoying to look at lines of 300 chars :)

The best would be to have some switch which in a given script could either detect that previous line ended with "\" or to reduce the prompt timeout to 0.

raszuk avatar Aug 20 '23 14:08 raszuk

Interesting, script server shouldn't rely on > at all. And it's definitely not waiting for any input to finish.

Did you try putting this command in a bash script, and call the bash script from script server?

bugy avatar Aug 20 '23 17:08 bugy