File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 7
7
8
8
9
9
class Browser :
10
- def __init__ (self , path = None ):
10
+ def __init__ (self , debug = None , path = None ):
11
11
self .pipes = Pipe ()
12
12
13
+ if not debug : # false o None
14
+ stderr = subprocess .DEVNULL
15
+ elif debug is True :
16
+ stderr = None
17
+ else :
18
+ stderr = debug
19
+
13
20
if not path :
14
21
if platform .system () == "Windows" :
15
22
path = r"C:\Program Files\Google\Chrome\Application\chrome.exe"
16
23
elif platform .system () == "Linux" :
17
24
path = "/usr/bin/google-chrome-stable"
18
25
else :
19
26
raise ValueError ("You must set path to a chrome-like browser" )
27
+
20
28
new_env = os .environ .copy ()
21
29
new_env ["CHROMIUM_PATH" ] = path
22
30
win_only = {}
23
31
if platform .system () == "Windows" :
24
32
win_only = {"creationflags" : subprocess .CREATE_NEW_PROCESS_GROUP }
33
+
25
34
proc = subprocess .Popen (
26
35
[
27
36
sys .executable ,
@@ -32,7 +41,7 @@ def __init__(self, path=None):
32
41
close_fds = True ,
33
42
stdin = self .pipe .read_to_chromium ,
34
43
stdout = self .pipe .write_from_chromium ,
35
- stderr = None ,
44
+ stderr = stderr ,
36
45
env = new_env ,
37
46
** win_only ,
38
47
)
You can’t perform that action at this time.
0 commit comments