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

Side by Side Diff: shell/subcmds/shell_cmd.py

Issue 6626039: Revert "Plumb in crprocess instead of RunCommand to allow quiet operation." (Closed) Base URL: http://git.chromium.org/git/chromite.git@master
Patch Set: Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « shell/subcmds/portage_cmds.py ('k') | shell/subcmds/workon_cmd.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Implementation of the 'shell' chromite command.""" 5 """Implementation of the 'shell' chromite command."""
6 6
7 # Python imports 7 # Python imports
8 import optparse 8 import optparse
9 import os 9 import os
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 # Parse options for command... 86 # Parse options for command...
87 # ...note that OptionParser will eat the '--' if it's there, which is what 87 # ...note that OptionParser will eat the '--' if it's there, which is what
88 # we want.. 88 # we want..
89 usage_str = ('usage: %%prog [chromite_options] %s [options] [VAR=value] ' 89 usage_str = ('usage: %%prog [chromite_options] %s [options] [VAR=value] '
90 '[-- command [arg1] [arg2] ...]') % raw_argv[0] 90 '[-- command [arg1] [arg2] ...]') % raw_argv[0]
91 parser = optparse.OptionParser(usage=usage_str) 91 parser = optparse.OptionParser(usage=usage_str)
92 (_, argv) = parser.parse_args(raw_argv[1:]) 92 (_, argv) = parser.parse_args(raw_argv[1:])
93 93
94 # Enter the chroot if needed... 94 # Enter the chroot if needed...
95 if not cros_lib.IsInsideChroot(): 95 if not cros_lib.IsInsideChroot():
96 self._oper.Info('ENTERING THE CHROOT')
97 utils.EnterChroot(chroot_config, (self, 'Run'), raw_argv) 96 utils.EnterChroot(chroot_config, (self, 'Run'), raw_argv)
98 else: 97 else:
99 # We'll put CWD as src/scripts when running the command. Since everyone 98 # We'll put CWD as src/scripts when running the command. Since everyone
100 # running by hand has their cwd there, it is probably the safest. 99 # running by hand has their cwd there, it is probably the safest.
101 cwd = os.path.join(utils.SRCROOT_PATH, 'src', 'scripts') 100 cwd = os.path.join(utils.SRCROOT_PATH, 'src', 'scripts')
102 101
103 # By default, no special environment... 102 # By default, no special environment...
104 env = None 103 env = None
105 104
106 if not argv: 105 if not argv:
107 # If no arguments, we'll just start bash. 106 # If no arguments, we'll just start bash.
108 argv = ['bash'] 107 argv = ['bash']
109 else: 108 else:
110 # Parse the command line, looking at the beginning for VAR=value type 109 # Parse the command line, looking at the beginning for VAR=value type
111 # statements. I couldn't figure out a way to get bash to do this for 110 # statements. I couldn't figure out a way to get bash to do this for
112 # me. 111 # me.
113 user_env, argv = _SplitEnvFromArgs(argv) 112 user_env, argv = _SplitEnvFromArgs(argv)
114 if not argv: 113 if not argv:
115 cros_lib.Die('No command specified') 114 cros_lib.Die('No command specified')
116 115
117 # If there was some environment, use it to override the standard 116 # If there was some environment, use it to override the standard
118 # environment. 117 # environment.
119 if user_env: 118 if user_env:
120 env = dict(os.environ) 119 env = dict(os.environ)
121 env.update(user_env) 120 env.update(user_env)
122 121
123 # Don't show anything special for errors; we'll let the shell report them. 122 # Don't show anything special for errors; we'll let the shell report them.
124 # TODO(sjg) We don't use RunScript() here since this may become an
125 # interactive shell. Would prefer that this becomes its own command to
126 # avoid this problem.
127 cros_lib.RunCommand(argv, cwd=cwd, env=env, error_ok=True, 123 cros_lib.RunCommand(argv, cwd=cwd, env=env, error_ok=True,
128 ignore_sigint=True) 124 ignore_sigint=True)
OLDNEW
« no previous file with comments | « shell/subcmds/portage_cmds.py ('k') | shell/subcmds/workon_cmd.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698