MCPcopy
hub / github.com/containerd/containerd / writeStopSignalScript

Function writeStopSignalScript

integration/container_stop_signal_test.go:170–197  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

168}
169
170func writeStopSignalScript(t *testing.T) string {
171 t.Helper()
172
173 scriptDir := t.TempDir()
174 scriptPath := filepath.Join(scriptDir, "stop-signal.sh")
175 script := `#!/bin/sh
176set -eu
177
178signal="$1"
179child=""
180
181cleanup() {
182 echo "Received ${signal}"
183 if [ -n "${child}" ]; then
184 kill "${child}" 2>/dev/null || true
185 fi
186 exit 0
187}
188
189trap cleanup "${signal}"
190
191sleep 5000 &
192child="$!"
193wait "${child}"
194`
195 require.NoError(t, os.WriteFile(scriptPath, []byte(script), 0644))
196 return scriptDir
197}

Callers 1

TestContainerStopSignalsFunction · 0.85

Calls 1

WriteFileMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…