Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pty to avoid buffering #5

Open
egonelbre opened this issue Mar 6, 2018 · 0 comments
Open

Use pty to avoid buffering #5

egonelbre opened this issue Mar 6, 2018 · 0 comments

Comments

@egonelbre
Copy link
Member

When starting some programs using exec.Cmd it will start them as buffering. Which means you don't see the live-output from the program.

When you have access to the source, this can be changed with:

// #include <stdio.h>
// #include <errno.h>
import "C"

func init() { C.setvbuf(C.stdout, nil, C._IONBF, 0) }

However it's possible to use something like https://github.com/kr/pty to avoid this problem. kr/pty doesn't have Windows support, but based on https://www.codeproject.com/Articles/16163/Real-Time-Console-Output-Redirection and https://gist.github.com/zhangyoufu/be36035e94b8c0dcb1239a3c8b07a3b1... it should be possible to implement them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant