Replies: 1 comment
-
Looks like this is because exec doesn't execute in interactive mode which is ok I suppose. But it would be good to have option to be able execute here doc format content in container. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
To execute some shell command in teastcontainer one need to use .exec() with command converted to list and passed as parameter to exec(). e.g.
exec('gcloud config configurations create some-config'.split(' '))
and this looks works perfectly.But how I can e.g. execute multiline sql query inside mysql testcontainer with mysql client cli using .exec() ?
eg:
`mysql -umyUser -pmyPassword
<< "EOF"
CREATE DATABASE IF NOT EXISTS
someDB
;USE
someDB
;CREATE TABLE IF NOT EXISTS
SomeTable
(-- multiline sql query is here
EOF`
or even simpler code:
mysql -utestuser -ptestPassword1 << "EOF"
SELECT 1;
EOF
I put sql query which is in here doc style into separate array element but it returns exitCode=1 and empty output.
Beta Was this translation helpful? Give feedback.
All reactions