script-server
script-server copied to clipboard
Add support for stdin parameters
At the moment all the parameters are passed to a script via common line arguments (e.g. my_script.sh -param1 ABC -param2 DEF) And during script execution, a user can input text to stdin (if, for example, he is asked for some additional confirmation).
It would be nice, to have such parameters, which would be sent to stdin automatically by Script server, when, for example, special output text is detected. E.g.
{
"parameter": "username",
"expected_text": "Enter your name"
}
So, when a script is executed and prints:
Enter your name, Script server will write username parameter to stdin
Some more examples of similar functionality: https://pexpect.readthedocs.io/en/stable/overview.html
Done, it's configurable via 2 options:
-
pass_as, can be one of [argument, env_variable, stdin] -
stdin_expected_text, optional, specifies after which value the parameter should be sent. By default, the parameter is sent to stdin on script startup