(self)
| 34 | line_action(line) |
| 35 | |
| 36 | def start(self): |
| 37 | if sys.platform == 'win32': |
| 38 | args = [os.path.join(self.working_dir, 'run.bat')] |
| 39 | # things break otherwise |
| 40 | env = dict(os.environ) |
| 41 | else: |
| 42 | args = ['sh', os.path.join(self.working_dir, 'run.sh')] |
| 43 | # Path needs to be passed through, otherwise some compilers (e.g gcc) can get confused and not find things |
| 44 | env = {'PATH': os.environ['PATH']} |
| 45 | |
| 46 | env['PLAYER_KEY'] = str(self.player_key) |
| 47 | env['RUST_BACKTRACE'] = '1' |
| 48 | env['BC_PLATFORM'] = self._detect_platform() |
| 49 | |
| 50 | if isinstance(self.socket_file, tuple): |
| 51 | # tcp port |
| 52 | env['TCP_PORT'] = str(self.socket_file[1]) |
| 53 | else: |
| 54 | env['SOCKET_FILE'] = self.socket_file |
| 55 | |
| 56 | cwd = self.working_dir |
| 57 | self.process = psutil.Popen(args, env=env, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=-1) |
| 58 | |
| 59 | def guess_language(self): |
| 60 | children = self.process.children(recursive=True) |
no test coverage detected