aboutsummaryrefslogtreecommitdiff
path: root/git_hooks_handle.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--git_hooks_handle.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/git_hooks_handle.go b/git_hooks_handle.go
index 86300cb..f650436 100644
--- a/git_hooks_handle.go
+++ b/git_hooks_handle.go
@@ -31,11 +31,21 @@ func hooks_handle_connection(conn net.Conn) (err error) {
pid := ucred.Pid
- _ = pid
+ conn.Write([]byte{0})
+ fmt.Fprintf(conn, "your PID is %d\n", pid)
return nil
}
+func serve_git_hooks(listener net.Listener) error {
+ conn, err := listener.Accept()
+ if err != nil {
+ return err
+ }
+
+ return hooks_handle_connection(conn)
+}
+
func get_ucred(fd *os.File) (*syscall.Ucred, error) {
ucred, err := syscall.GetsockoptUcred(int(fd.Fd()), syscall.SOL_SOCKET, syscall.SO_PEERCRED)
if err != nil {