aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport/file/client.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-07-25 14:26:17 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2017-07-25 14:26:17 +0200
commitaf3f5e2b9139674b49c5caf0bc06e93cbc426727 (patch)
tree06dbaadba6bbee95afd3212438e2434846312dcc /plumbing/transport/file/client.go
parent8e83055176bbbbbde206884f10dc238fd378b9b4 (diff)
downloadgo-git-af3f5e2b9139674b49c5caf0bc06e93cbc426727.tar.gz
transport: context package support
Diffstat (limited to 'plumbing/transport/file/client.go')
-rw-r--r--plumbing/transport/file/client.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/plumbing/transport/file/client.go b/plumbing/transport/file/client.go
index b6d60c1..0b42abf 100644
--- a/plumbing/transport/file/client.go
+++ b/plumbing/transport/file/client.go
@@ -30,7 +30,9 @@ func NewClient(uploadPackBin, receivePackBin string) transport.Transport {
})
}
-func (r *runner) Command(cmd string, ep transport.Endpoint, auth transport.AuthMethod) (common.Command, error) {
+func (r *runner) Command(cmd string, ep transport.Endpoint, auth transport.AuthMethod,
+) (common.Command, error) {
+
switch cmd {
case transport.UploadPackServiceName:
cmd = r.UploadPackBin
@@ -72,6 +74,11 @@ func (c *command) StdoutPipe() (io.Reader, error) {
return c.cmd.StdoutPipe()
}
+func (c *command) Kill() error {
+ c.cmd.Process.Kill()
+ return c.Close()
+}
+
// Close waits for the command to exit.
func (c *command) Close() error {
if c.closed {
@@ -81,6 +88,7 @@ func (c *command) Close() error {
defer func() {
c.closed = true
_ = c.stderrCloser.Close()
+
}()
err := c.cmd.Wait()