MCPcopy Create free account
hub / github.com/battlecode/battlecode-2018 / start

Method start

battlecode-manager/player_plain.py:36–57  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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)

Callers 9

matchmaker.pyFile · 0.45
run_gameFunction · 0.45
run_gameFunction · 0.45
gui.pyFile · 0.45
run_matchFunction · 0.45
stream_logsMethod · 0.45
start_serverFunction · 0.45
start_viewer_serverFunction · 0.45
__init__Method · 0.45

Calls 1

_detect_platformMethod · 0.80

Tested by

no test coverage detected