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

A bit of a usage example would be nice.

Open MJBrune opened this issue 6 years ago • 3 comments

Hey duder,

Am looking at this and looks really good but would love a bit of of an example on how to use the library.

Thanks, Michael Brune

MJBrune avatar Mar 31 '18 04:03 MJBrune

Hello @MJBrune

Have you tried the stuff in the example folder?

The instructions are at the top of server.go - not the ideal place to expect them, I realize that.

You are welcome to submit a PR if you'd like to improve the examples.

Regards, iamacarpet

iamacarpet avatar Apr 03 '18 07:04 iamacarpet

Yup I've been pouring over the server.go file in order to look at how you use stdin, stdout and stderr from the pty. It seems like there isn't a way to get stderr nor is there a way to ensure the terminal flushes?

Also with examples was thinking it would be nice to toss some in the readme. like this https://github.com/gorilla/mux#examples

Thanks, Michael Brune

MJBrune avatar Apr 03 '18 17:04 MJBrune

True, I can’t see any reference to stderr

I’ll be honest, it has been a good while since I wrote this and haven’t needed to do much with it since, so I couldn’t say if that is an oversight or just that stderr isn’t exposed independently by the base library. I’d like to say the latter, but can’t say without fully checking.

I can say this has been in use a lot since publish on our internal projects and we’ve never noticed anything missing from our PowerShell output. Likewise with the need to flush, it has always seemed instantaneous. If this is with the stdin and stdout file handles, they aren’t buffered AFAIK, especially not on the Go side.

If you find anything that needs fixing, or would like to submit a README when you’ve got to grips with it, a PR would always be welcome.

Regards, iamacarpet

iamacarpet avatar Apr 03 '18 17:04 iamacarpet