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

Side by Side Diff: pydir/utils.py

Issue 611983003: Subzero: Change the echoing in shellcmd(). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 2 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 import os 1 import os
2 import subprocess 2 import subprocess
3 import sys 3 import sys
4 4
5 def shellcmd(command, echo=True): 5 def shellcmd(command, echo=True):
6 if echo: print '[cmd]', command
7
8 if not isinstance(command, str): 6 if not isinstance(command, str):
9 command = ' '.join(command) 7 command = ' '.join(command)
10 8
9 if echo: print '[cmd]', command
10
11 stdout_result = subprocess.check_output(command, shell=True) 11 stdout_result = subprocess.check_output(command, shell=True)
12 if echo: sys.stdout.write(stdout_result) 12 if echo: sys.stdout.write(stdout_result)
13 return stdout_result 13 return stdout_result
14 14
15 def FindBaseNaCl(): 15 def FindBaseNaCl():
16 """Find the base native_client/ directory.""" 16 """Find the base native_client/ directory."""
17 nacl = 'native_client' 17 nacl = 'native_client'
18 path_list = os.getcwd().split(os.sep) 18 path_list = os.getcwd().split(os.sep)
19 if nacl not in path_list: 19 if nacl not in path_list:
20 return None 20 return None
21 last_index = len(path_list) - path_list[::-1].index(nacl) 21 last_index = len(path_list) - path_list[::-1].index(nacl)
22 return os.sep.join(path_list[:last_index]) 22 return os.sep.join(path_list[:last_index])
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