| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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 linux freebsd netbsd openbsd android |
| 6 |
| 7 package venv |
| 8 |
| 9 import ( |
| 10 "os" |
| 11 "path/filepath" |
| 12 "syscall" |
| 13 |
| 14 "github.com/luci/luci-go/common/errors" |
| 15 ) |
| 16 |
| 17 // longestGeneratedScriptPath returns the path of the longest generated script |
| 18 // given a VirtualEnv root. |
| 19 func longestGeneratedScriptPath(baseDir string) string { |
| 20 return venvBinPath(baseDir, "python-config") |
| 21 } |
| 22 |
| 23 // venvBinPath resolves the path to a VirtualEnv binary. |
| 24 func venvBinPath(root, name string) string { |
| 25 return filepath.Join(root, "bin", name) |
| 26 } |
| 27 |
| 28 func checkProcessRunning(pid int) error { |
| 29 proc, err := os.FindProcess(pid) |
| 30 if err != nil { |
| 31 return errors.Annotate(err).Reason("failed to find process").Err
() |
| 32 } |
| 33 |
| 34 if err := proc.Signal(os.Signal(syscall.Signal(0))); err != nil { |
| 35 return errors.Annotate(err).Reason("failed to signal process").E
rr() |
| 36 } |
| 37 return nil |
| 38 } |
| OLD | NEW |