// workaround use this wait will not get exit status 3 error.
workaround use this wait will not get exit status 3 error.
// workaround use this wait will not get exit status 3 error .
func wait(pid int, rusage *syscall.Rusage) (int, *syscall.WaitStatus, error) {
	var status syscall.WaitStatus
	var siginfo [128]byte
	psig := &siginfo[0]
	_, _, e := syscall.Syscall6(syscall.SYS_WAITID, 1, uintptr(pid), uintptr(unsafe.Pointer(psig)), syscall.WEXITED|syscall.WNOWAIT, 0, 0)
	runtime.KeepAlive(psig)
	if e != 0 {
		if e != syscall.ENOSYS {
			return 0, nil, os.NewSyscallError("waitid", e)
		}
	}
	wpid, err := syscall.Wait4(pid, &status, 0, rusage) 
	if err != nil {
		return 0, nil, err
	}
	return wpid, &status, err
}
func wait ( pid int , rusage * syscall . Rusage ) ( int , * syscall . WaitStatus , error ) { var status syscall . WaitStatus var siginfo [ 128 ] byte psig := & siginfo [ 0 ] _ , _ , e := syscall . Syscall6 ( syscall . SYS_WAITID , 1 , uintptr ( pid ) , uintptr ( unsafe . Pointer ( psig ) ) , syscall . WEXITED | syscall . WNOWAIT , 0 , 0 ) runtime . KeepAlive ( psig ) if e != 0 { if e != syscall . ENOSYS { return 0 , nil , os . NewSyscallError ( " " , e ) } } wpid , err := syscall . Wait4 ( pid , & status , 0 , rusage ) if err != nil { return 0 , nil , err } return wpid , & status , err }
workaround use this wait will not get exit status 3 error.
workaround use this wait will not get exit status 3 error .
// If we can block until Wait4 will succeed immediately, do so. // psig may be garbage collected before // syscall, KeepAlive make it alive util // sysacll return. // for rusage collect