| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // +build darwin dragonfly freebsd linux netbsd openbsd | 5 // +build darwin dragonfly freebsd linux netbsd openbsd |
| 6 | 6 |
| 7 package streamclient | 7 package streamclient |
| 8 | 8 |
| 9 import ( | 9 import ( |
| 10 "fmt" | 10 "fmt" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 func newUnixSocketClient(path string) (Client, error) { | 25 func newUnixSocketClient(path string) (Client, error) { |
| 26 // Ensure that the supplied path exists and is a named pipe. | 26 // Ensure that the supplied path exists and is a named pipe. |
| 27 info, err := os.Lstat(path) | 27 info, err := os.Lstat(path) |
| 28 if err != nil { | 28 if err != nil { |
| 29 return nil, fmt.Errorf("failed to stat file [%s]: %s", path, err
) | 29 return nil, fmt.Errorf("failed to stat file [%s]: %s", path, err
) |
| 30 } | 30 } |
| 31 if info.Mode()&os.ModeSocket == 0 { | 31 if info.Mode()&os.ModeSocket == 0 { |
| 32 return nil, fmt.Errorf("not a named pipe: [%s]", path) | 32 return nil, fmt.Errorf("not a named pipe: [%s]", path) |
| 33 } | 33 } |
| 34 | 34 |
| 35 » return &clientImpl{func() (io.WriteCloser, error) { | 35 » return &clientImpl{ |
| 36 » » return net.Dial("unix", path) | 36 » » factory: func() (io.WriteCloser, error) { |
| 37 » }}, nil | 37 » » » return net.Dial("unix", path) |
| 38 » » }, |
| 39 » }, nil |
| 38 } | 40 } |
| OLD | NEW |