...
1
2
3 package main
4
5 import (
6 "context"
7 "fmt"
8 "os"
9
10 "github.com/Microsoft/hcsshim/internal/shimdiag"
11 "github.com/urfave/cli"
12 )
13
14 func main() {
15 app := cli.NewApp()
16 app.Name = "shimdiag"
17 app.Usage = "runhcs shim diagnostic tool"
18 app.Commands = []cli.Command{
19 listCommand,
20 execCommand,
21 stacksCommand,
22 tasksCommand,
23 shareCommand,
24 }
25 if err := app.Run(os.Args); err != nil {
26 fmt.Fprintln(os.Stderr, err)
27 os.Exit(1)
28 }
29 }
30
31 func getPid(shimName string) (int32, error) {
32 shim, err := shimdiag.GetShim(shimName)
33 if err != nil {
34 return 0, err
35 }
36 defer shim.Close()
37
38 svc := shimdiag.NewShimDiagClient(shim)
39 resp, err := svc.DiagPid(context.Background(), &shimdiag.PidRequest{})
40 if err != nil {
41 return 0, err
42 }
43 return resp.Pid, nil
44 }
45
View as plain text