Skip to content

Commit

Permalink
Plan9 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
alco committed Aug 20, 2014
1 parent 37ba45e commit 0c06e35
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
5 changes: 5 additions & 0 deletions exit_status.go
Expand Up @@ -3,6 +3,7 @@
package main

import (
"os"
"os/exec"
"syscall"
)
Expand All @@ -17,3 +18,7 @@ func getExitStatus(err error) int {
}
return 1
}

func makeSignal(sig byte) os.Signal {
return syscall.Signal(int(sig));
}
14 changes: 14 additions & 0 deletions exit_status_plan9.go
@@ -1,6 +1,7 @@
package main

import (
"os"
"os/exec"
"syscall"
)
Expand All @@ -15,3 +16,16 @@ func getExitStatus(err error) int {
}
return 1
}

func makeSignal(sig byte) os.Signal {
switch sig {
case 128:
return syscall.Note("interrupt")
case 129:
return syscall.Note("sys: kill")
case 15:
return syscall.Note("kill")
default:
return syscall.Note("")
}
}
3 changes: 1 addition & 2 deletions io.go
Expand Up @@ -4,7 +4,6 @@ import (
"io"
"os"
"os/exec"
"syscall"
)

func wrapStdin(proc *exec.Cmd, stdin io.Reader, done chan bool) {
Expand Down Expand Up @@ -113,7 +112,7 @@ func inLoop2(pipe io.WriteCloser, proc *exec.Cmd, stdin io.Reader, done chan boo
sig_err := proc.Process.Signal(os.Kill)
fatal_if(sig_err)
default:
sig_err := proc.Process.Signal(syscall.Signal(sig))
sig_err := proc.Process.Signal(makeSignal(sig))
fatal_if(sig_err)
}
break loop
Expand Down

0 comments on commit 0c06e35

Please sign in to comment.