go-sqlcmd icon indicating copy to clipboard operation
go-sqlcmd copied to clipboard

Ensure sqlcmd query doesn't return error after sqlcmd start

Open stuartpa opened this issue 2 years ago • 2 comments

Right now sqlcmd start does not block waiting for SQL Server to be running and ready for client connections.

So if sqlcmd query is immediately run, it will fail with:

C:\src\go-sqlcmd\cmd\modern>sqlcmd query
EOF
Error: EOF

We either need to make sqlcmd start have a blocking option so it doesn't return until SQL is ready for connections, or sqlcmd query and sqlcmd open ads etc. all block waiting for connection to succeed (up to timeout)

As part of testing, I have tried blocking sqlcmd start until the errorlog prints "recovery complete" which is the last entry in a normal successful start up, and sqlcmd query still fails with the above error message for a few seconds.

stuartpa avatar Feb 10 '23 09:02 stuartpa