Created
April 25, 2012 13:07
-
-
Save elazarl/2489584 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"io" | |
"os" | |
"time" | |
) | |
func singLine(line string,w io.Writer) { | |
time.Sleep(time.Second) | |
io.WriteString(w,line+"\n") | |
} | |
func Sing(w io.Writer) { | |
singLine("בים לבן קבוצת שחורים קוטפת",w) | |
singLine("בשדה כתנה קוטפת כל היום",w) | |
singLine("אוהו החמה יוקדת",w) | |
singLine("אוהו יוקדת כל היום",w) | |
} | |
// usage: | |
// $ mkfifo /tmp/kol1 && mkfifo /tmp/kol2 | |
// $ cat /tmp/kol1 | |
// $ cat /tmp/kol2 # in a separate terminal window | |
// $ go run byam_lavan.go >/tmp/kol1 2>/tmp/kol2 | |
func main() { | |
go Sing(os.Stderr) | |
time.Sleep(time.Millisecond*500) | |
Sing(os.Stdout) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment