Skip to content

Use pty to avoid buffering #5

@egonelbre

Description

@egonelbre

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions