Source File
exec_posix.go
Belonging Package
os
package os
import (
)
if != nil && .Sys == nil && .Dir != "" {
if , := Stat(.Dir); != nil {
:= .(*PathError)
.Op = "chdir"
return nil,
}
}
:= &syscall.ProcAttr{
Dir: .Dir,
Env: .Env,
Sys: .Sys,
}
if .Env == nil {
.Env, = execenv.Default(.Sys)
if != nil {
return nil,
}
}
.Files = make([]uintptr, 0, len(.Files))
for , := range .Files {
.Files = append(.Files, .Fd())
}
, , := syscall.StartProcess(, , )
type ProcessState struct {
pid int // The process's id.
status syscall.WaitStatus // System-dependent status info.
rusage *syscall.Rusage
}
func ( *ProcessState) () int {
return .pid
}
func ( *ProcessState) () bool {
return .status.Exited()
}
func ( *ProcessState) () bool {
return .status.ExitStatus() == 0
}
func ( *ProcessState) () interface{} {
return .status
}
func ( *ProcessState) () interface{} {
return .rusage
}
func ( *ProcessState) () string {
if == nil {
return "<nil>"
}
:= .Sys().(syscall.WaitStatus)
:= ""
switch {
case .Exited():
= "exit status " + itoa(.ExitStatus())
case .Signaled():
= "signal: " + .Signal().String()
case .Stopped():
= "stop signal: " + .StopSignal().String()
if .StopSignal() == syscall.SIGTRAP && .TrapCause() != 0 {
+= " (trap " + itoa(.TrapCause()) + ")"
}
case .Continued():
= "continued"
}
if .CoreDump() {
+= " (core dumped)"
}
return
}
if == nil {
return -1
}
return .status.ExitStatus()
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |