summaryrefslogtreecommitdiff
path: root/src/pkg/os/exec_posix.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/os/exec_posix.go')
-rw-r--r--src/pkg/os/exec_posix.go17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/pkg/os/exec_posix.go b/src/pkg/os/exec_posix.go
index 70351cfb3..f7b10f3c6 100644
--- a/src/pkg/os/exec_posix.go
+++ b/src/pkg/os/exec_posix.go
@@ -10,10 +10,19 @@ import (
"syscall"
)
+// The only signal values guaranteed to be present on all systems
+// are Interrupt (send the process an interrupt) and Kill (force
+// the process to exit).
+var (
+ Interrupt Signal = syscall.SIGINT
+ Kill Signal = syscall.SIGKILL
+)
+
func startProcess(name string, argv []string, attr *ProcAttr) (p *Process, err error) {
- // Double-check existence of the directory we want
+ // If there is no SysProcAttr (ie. no Chroot or changed
+ // UID/GID), double-check existence of the directory we want
// to chdir into. We can make the error clearer this way.
- if attr != nil && attr.Dir != "" {
+ if attr != nil && attr.Sys == nil && attr.Dir != "" {
if _, err := Stat(attr.Dir); err != nil {
pe := err.(*PathError)
pe.Op = "chdir"
@@ -109,9 +118,9 @@ func (p *ProcessState) String() string {
case status.Exited():
res = "exit status " + itod(status.ExitStatus())
case status.Signaled():
- res = "signal " + itod(int(status.Signal()))
+ res = "signal: " + status.Signal().String()
case status.Stopped():
- res = "stop signal " + itod(int(status.StopSignal()))
+ res = "stop signal: " + status.StopSignal().String()
if status.StopSignal() == syscall.SIGTRAP && status.TrapCause() != 0 {
res += " (trap " + itod(status.TrapCause()) + ")"
}