Source file misc/cgo/testplugin/testdata/forkexec/main.go
1 // Copyright 2021 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 import ( 8 "os" 9 "os/exec" 10 _ "plugin" 11 "sync" 12 ) 13 14 func main() { 15 if os.Args[1] != "1" { 16 return 17 } 18 19 var wg sync.WaitGroup 20 for i := 0; i < 8; i++ { 21 wg.Add(1) 22 go func() { 23 defer wg.Done() 24 // does not matter what we exec, just exec itself 25 cmd := exec.Command("./forkexec.exe", "0") 26 cmd.Run() 27 }() 28 } 29 wg.Wait() 30 } 31