bugy / script-server

Web UI for your scripts with execution management
Other
1.52k stars 244 forks source link

Slow execution of multiline commands #688

Open raszuk opened 10 months ago

raszuk commented 10 months ago

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 !

bugy commented 10 months ago

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?

raszuk commented 10 months ago

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.

bugy commented 10 months ago

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?