MCPcopy
hub / github.com/cloudflare/tableflip / newTestProcess

Function newTestProcess

process_test.go:102–128  ·  view source on GitHub ↗
(fds []*os.File, envstr []string)

Source from the content-addressed store, hash-verified

100}
101
102func newTestProcess(fds []*os.File, envstr []string) (*testProcess, error) {
103 environ := make(map[string]string)
104 for _, entry := range envstr {
105 parts := strings.SplitN(entry, "=", 2)
106 if len(parts) != 2 {
107 return nil, fmt.Errorf("invalid env entry: %s", entry)
108 }
109 environ[parts[0]] = parts[1]
110 }
111
112 return &testProcess{
113 fds,
114 env{
115 newFile: func(fd uintptr, name string) *os.File {
116 return fds[fd]
117 },
118 getenv: func(key string) string {
119 return environ[key]
120 },
121 closeOnExec: func(int) {},
122 },
123 make(chan os.Signal, 1),
124 make(chan error),
125 make(chan error),
126 make(chan struct{}),
127 }, nil
128}
129
130func (tp *testProcess) Signal(sig os.Signal) error {
131 select {

Callers 1

testEnvFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…