ITP WiP
This commit is contained in:
33
tools/itb/bin/itb_start
Executable file
33
tools/itb/bin/itb_start
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
import random
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
def start(url):
|
||||
debug_port = random.randint(9000, 9999)
|
||||
chrome_cmd = [
|
||||
'/usr/bin/google-chrome',
|
||||
'--headless=new',
|
||||
'--no-sandbox',
|
||||
'--remote-debugging-port=' + str(debug_port),
|
||||
url
|
||||
]
|
||||
|
||||
process = subprocess.Popen(
|
||||
chrome_cmd,
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
start_new_session=True
|
||||
)
|
||||
|
||||
print({
|
||||
"pid": process.pid,
|
||||
"debug_port": debug_port
|
||||
})
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: itb_start <url>")
|
||||
sys.exit(1)
|
||||
start(sys.argv[1])
|
||||
Reference in New Issue
Block a user