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

Side by Side Diff: client/cmd/logdog_butler/streamserver_posix.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
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 // +build darwin dragonfly freebsd linux netbsd openbsd
6
7 package main
8
9 import (
10 "errors"
11 "fmt"
12
13 "github.com/luci/luci-go/client/internal/logdog/butler/streamserver"
14 "golang.org/x/net/context"
15 )
16
17 const (
18 // An example stream server URI.
19 exampleStreamServerURI = streamServerURI("unix:/var/run/butler.sock")
20 )
21
22 type streamServerURI string
23
24 func (u streamServerURI) Parse() (string, error) {
25 typ, value := parseStreamServer(string(u))
26 if typ != "unix" {
27 return "", fmt.Errorf("unsupported URI scheme: [%s]", typ)
28 }
29 if value == "" {
30 return "", errors.New("empty stream server path")
31 }
32 return value, nil
33 }
34
35 // Validates that the URI is correct for Windows.
36 func (u streamServerURI) Validate() (err error) {
37 _, err = u.Parse()
38 return
39 }
40
41 // Create a POSIX (UNIX named pipe) stream server
42 func createStreamServer(ctx context.Context, uri streamServerURI) streamserver.S treamServer {
43 path, err := uri.Parse()
44 if err != nil {
45 panic("Failed to parse stream server URI.")
46 }
47 return streamserver.NewNamedPipeServer(ctx, path)
48 }
OLDNEW
« no previous file with comments | « client/cmd/logdog_butler/main_windows.go ('k') | client/cmd/logdog_butler/streamserver_windows.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698