Closed JCoder01 closed 1 year ago
@apoorvdeshmukh @stuartpa @JyotikaGargg - I'd like suggestions on a proper fix. I see 2 basic options.
s.lineIO.Close()
calls where sqlcmd.Run
call os.Exit(0)
os.Exit(0)
and setupCloseHandler()
calls from sqlcmd.Run
and move them to cmd/sqlcmd
Option 1 keeps life simple for callers because they don't have to worry about assuring console close on ctrl-c before the process exits. Option 2 enables apps hosting pkg/sqlcmd
to allow custom behaviors for ctrl-c.
Some apps might want to host pkg/sqlcmd
in interactive mode but not exit on ctrl-c, as they need to do some other cleanup first.
input echo stops working when exiting with Ctrl + C. I Seems related to this https://github.com/peterh/liner/issues/104
There is no
Close()
when exiting: https://github.com/microsoft/go-sqlcmd/blob/main/pkg/console/console.go#L55