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

Side by Side Diff: vpython/run.go

Issue 2879493002: vpython: Print Python command when run. (Closed)
Patch Set: no need to check Created 3 years, 7 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 | « no previous file | 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
1 // Copyright 2017 The LUCI Authors. All rights reserved. 1 // Copyright 2017 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 package vpython 5 package vpython
6 6
7 import ( 7 import (
8 "os" 8 "os"
9 "os/exec" 9 "os/exec"
10 "os/signal" 10 "os/signal"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 prefixPATH(e, ve.BinDir) 88 prefixPATH(e, ve.BinDir)
89 89
90 // Run our bootstrapped Python command. 90 // Run our bootstrapped Python command.
91 cmd := ve.Interpreter().IsolatedCommand(c, opts.Args...) 91 cmd := ve.Interpreter().IsolatedCommand(c, opts.Args...)
92 cmd.Dir = opts.WorkDir 92 cmd.Dir = opts.WorkDir
93 cmd.Env = e.Sorted() 93 cmd.Env = e.Sorted()
94 cmd.Stdin = os.Stdin 94 cmd.Stdin = os.Stdin
95 cmd.Stdout = os.Stdout 95 cmd.Stdout = os.Stdout
96 cmd.Stderr = os.Stderr 96 cmd.Stderr = os.Stderr
97 97
98 logging.Debugf(c, "Running Python command: %s\nWorkDir: %s\nEnv: %s", cmd.Args, cmd.Dir, cmd.Env)
99
100 // Output the Python command being executed.
98 if err := runAndForwardSignals(c, cmd, cancelFunc); err != nil { 101 if err := runAndForwardSignals(c, cmd, cancelFunc); err != nil {
99 return errors.Annotate(err).Reason("failed to execute bo otstrapped Python").Err() 102 return errors.Annotate(err).Reason("failed to execute bo otstrapped Python").Err()
100 } 103 }
101 return nil 104 return nil
102 }) 105 })
103 if err != nil { 106 if err != nil {
104 return errors.Annotate(err).Err() 107 return errors.Annotate(err).Err()
105 } 108 }
106 return nil 109 return nil
107 } 110 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 components = append([]string(nil), components...) 163 components = append([]string(nil), components...)
161 164
162 // If there is a current PATH (likely), add that to the end. 165 // If there is a current PATH (likely), add that to the end.
163 cur, _ := env.Get("PATH") 166 cur, _ := env.Get("PATH")
164 if len(cur) > 0 { 167 if len(cur) > 0 {
165 components = append(components, cur) 168 components = append(components, cur)
166 } 169 }
167 170
168 env.Set("PATH", strings.Join(components, string(os.PathListSeparator))) 171 env.Set("PATH", strings.Join(components, string(os.PathListSeparator)))
169 } 172 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698