clipboard icon indicating copy to clipboard operation
clipboard copied to clipboard

Stdout already set error in macos

Open xudifsd opened this issue 8 years ago • 2 comments

I'm using osx 10.9.5, and following snippet gives a strange output:

package main

import (
    "fmt";
    "github.com/robertknight/clipboard";
    "time";
)

func main() {
    for {
        s, err := clipboard.ReadAll();
        if err != nil {
            fmt.Printf("%s\n", err);
        }
        fmt.Printf("%s\n", s);
        time.Sleep(1000 * time.Millisecond);
    }
}

it prints: whatever in clipboard exec: Stdout already set exec: Stdout already set ...

how can I fix this?

xudifsd avatar Mar 17 '16 14:03 xudifsd

Hi,

I cannot reproduce it on my osx 10.9.5(go version go1.6.2 darwin/amd64) and 10.11.4(go version go1.6 darwin/amd64). What version of Go are you using (go version)?

Maybe the error is coming from https://golang.org/src/os/exec/exec.go#L420 .

Thanks.

atotto avatar Jun 23 '16 09:06 atotto

P.S.

I use the following code:

package main

import (
    "fmt"
    "time"

    "github.com/atotto/clipboard"
)

func main() {
    for {
        s, err := clipboard.ReadAll()
        if err != nil {
            fmt.Printf("%s\n", err)
        }
        fmt.Printf("%s\n", s)
        time.Sleep(1000 * time.Millisecond)
    }
}

atotto avatar Jun 23 '16 09:06 atotto