Skip to content

Instantly share code, notes, and snippets.

@xiaq
Last active September 1, 2020 16:10
Show Gist options
  • Save xiaq/042aca2a7210fb00c4487337cf79632f to your computer and use it in GitHub Desktop.
Save xiaq/042aca2a7210fb00c4487337cf79632f to your computer and use it in GitHub Desktop.
cat > a.go <<EOF
package main
import (
"fmt"
"io"
"os"
)
func main() {
fmt.Println(os.Args[1:])
io.Copy(os.Stdout, os.NewFile(3, "fd 3"))
io.Copy(os.Stdout, os.NewFile(4, "fd 4"))
}
EOF
go run a.go 3<<FD3 4<<FD4 more arguments
This is FD 3
FD3
This is FD 4
FD4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment