Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: client/cmd/logdog_butler/streamserver_windows.go

Issue 2114253002: LogDog Butler: Catch SIGTERM on Linux. (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « client/cmd/logdog_butler/streamserver_posix.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
5 package main
6
7 import (
8 "errors"
9 "fmt"
10
11 "github.com/luci/luci-go/client/internal/logdog/butler/streamserver"
12 "golang.org/x/net/context"
13 )
14
15 const (
16 // An example stream server URI.
17 //
18 // This expands to: //localhost/pipe/<name>
19 exampleStreamServerURI = streamServerURI("net.pipe:logdog-butler")
20 )
21
22 type streamServerURI string
23
24 func (u streamServerURI) Parse() (string, error) {
25 typ, value := parseStreamServer(string(u))
26 if typ != "net.pipe" {
27 return "", errors.New("Unsupported URI scheme.")
28 }
29
30 if value == "" {
31 return "", errors.New("cannot have empty pipe name")
32 }
33 return value, nil
34 }
35
36 // Validates that the URI is correct for Windows.
37 func (u streamServerURI) Validate() error {
38 _, err := u.Parse()
39 return err
40 }
41
42 // Create a Windows stream server.
43 func createStreamServer(ctx context.Context, uri streamServerURI) streamserver.S treamServer {
44 name, err := uri.Parse()
45 if err != nil {
46 panic("Failed to parse stream server URI.")
47 }
48 return streamserver.NewNamedPipeServer(ctx, fmt.Sprintf(`\\.\pipe\%s`, n ame))
49 }
OLDNEW
« no previous file with comments | « client/cmd/logdog_butler/streamserver_posix.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698