コード例 #1
0
ファイル: pipeline.go プロジェクト: Ferrari/playground
func main() {
	p := pipe.Line(
		pipe.ReadFile("./test.txt"),
		pipe.Exec("lpr"),
	)
	output, err := pipe.CombinedOutput(p)
	if err != nil {
		fmt.Printf("%v\n", err)
	}
	fmt.Printf("%s", output)
}
コード例 #2
0
ファイル: pipeline1.go プロジェクト: Ferrari/playground
func main() {
	output, err := pipe.CombinedOutput(
		pipe.Line(
			pipe.Exec("ls", "-la", "/usr/bin"),
			pipe.System("grep pp"),
			pipe.WriteFile("grep.txt", 0644),
		),
	)

	if err != nil {
		log.Fatal(err)
	}

	println(string(output))
}