| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 # | 3 # |
| 4 # Use of this source code is governed by a BSD-style license | 4 # Use of this source code is governed by a BSD-style license |
| 5 # that can be found in the LICENSE file in the root of the source | 5 # that can be found in the LICENSE file in the root of the source |
| 6 # tree. An additional intellectual property rights grant can be found | 6 # tree. An additional intellectual property rights grant can be found |
| 7 # in the file PATENTS. All contributing project authors may | 7 # in the file PATENTS. All contributing project authors may |
| 8 # be found in the AUTHORS file in the root of the source tree. | 8 # be found in the AUTHORS file in the root of the source tree. |
| 9 | 9 |
| 10 """Script for constraining traffic on the local machine.""" | 10 """Script for constraining traffic on the local machine.""" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 cmd_list = ipfw_command[:] + [str(x) for x in command] | 180 cmd_list = ipfw_command[:] + [str(x) for x in command] |
| 181 cmd_string = ' '.join(cmd_list) | 181 cmd_string = ' '.join(cmd_list) |
| 182 logging.debug('Running command: %s', cmd_string) | 182 logging.debug('Running command: %s', cmd_string) |
| 183 process = subprocess.Popen(cmd_list, stdout=subprocess.PIPE, | 183 process = subprocess.Popen(cmd_list, stdout=subprocess.PIPE, |
| 184 stderr=subprocess.PIPE) | 184 stderr=subprocess.PIPE) |
| 185 output, error = process.communicate() | 185 output, error = process.communicate() |
| 186 if process.returncode != 0: | 186 if process.returncode != 0: |
| 187 raise NetworkEmulatorError(fail_msg, cmd_string, process.returncode, output, | 187 raise NetworkEmulatorError(fail_msg, cmd_string, process.returncode, output, |
| 188 error) | 188 error) |
| 189 return output.strip() | 189 return output.strip() |
| OLD | NEW |