1
2
3
4
5
6
7 package main
8
9
10
11
12 import (
13 "fmt"
14 "os"
15 "syscall"
16 )
17
18
19
20
21
22
23 const (
24 fd = 30
25 )
26
27 func init() {
28 var p [2]int
29 if e := syscall.Pipe(p[0:]); e != nil {
30 fmt.Fprintf(os.Stderr, "pipe: %v\n", e)
31 os.Exit(2)
32 }
33
34 if e := dup2(p[0], fd); e != nil {
35 fmt.Fprintf(os.Stderr, "dup2: %v\n", e)
36 os.Exit(2)
37 }
38
39 const str = "PASS"
40 if n, e := syscall.Write(p[1], []byte(str)); e != nil || n != len(str) {
41 fmt.Fprintf(os.Stderr, "write: %d %v\n", n, e)
42 os.Exit(2)
43 }
44
45 if e := syscall.Close(p[1]); e != nil {
46 fmt.Fprintf(os.Stderr, "close: %v\n", e)
47 os.Exit(2)
48 }
49 }
50
51 func main() {
52 }
53
View as plain text