(args, sites, discard_output=True)
| 49 | |
| 50 | |
| 51 | def start_replay_server(args, sites, discard_output=True): |
| 52 | with tempfile.NamedTemporaryFile(prefix='callstats-inject-', suffix='.js', |
| 53 | mode='wt', delete=False) as f: |
| 54 | injection = f.name |
| 55 | generate_injection(f, sites, args.refresh) |
| 56 | http_port = 4080 + args.port_offset |
| 57 | https_port = 4443 + args.port_offset |
| 58 | cmd_args = [ |
| 59 | args.replay_bin, |
| 60 | "--port=%s" % http_port, |
| 61 | "--ssl_port=%s" % https_port, |
| 62 | "--no-dns_forwarding", |
| 63 | "--use_closest_match", |
| 64 | "--no-diff_unknown_requests", |
| 65 | "--inject_scripts=deterministic.js,{}".format(injection), |
| 66 | args.replay_wpr, |
| 67 | ] |
| 68 | print("=" * 80) |
| 69 | print_command(cmd_args) |
| 70 | if discard_output: |
| 71 | with open(os.devnull, 'w') as null: |
| 72 | server = subprocess.Popen(cmd_args, stdout=null, stderr=null) |
| 73 | else: |
| 74 | server = subprocess.Popen(cmd_args) |
| 75 | print("RUNNING REPLAY SERVER: %s with PID=%s" % (args.replay_bin, server.pid)) |
| 76 | print("=" * 80) |
| 77 | return {'process': server, 'injection': injection} |
| 78 | |
| 79 | |
| 80 | def stop_replay_server(server): |
no test coverage detected
searching dependent graphs…