File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -70,12 +70,25 @@ impl Command {
70
70
}
71
71
72
72
fn launch_mpv ( command : String , args : Vec < String > , url : & str ) -> Result < ( ) , io:: Error > {
73
- process:: Command :: new ( command)
74
- . stdout ( process:: Stdio :: null ( ) )
75
- . stderr ( process:: Stdio :: null ( ) )
76
- . args ( args)
77
- . arg ( url)
78
- . spawn ( ) ?;
73
+ let mut command = process:: Command :: new ( command) ;
74
+
75
+ command. stdout ( process:: Stdio :: null ( ) ) ;
76
+ command. stderr ( process:: Stdio :: null ( ) ) ;
77
+ command. args ( args) ;
78
+ command. arg ( url) ;
79
+
80
+ // NOTE: On Windows, browser spawns process into a Job object.
81
+ // NOTE: We need to detach player from the job, so it won't get killed after we're done,
82
+ // NOTE: See https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging#closing_the_native_app
83
+ #[ cfg( target_family = "windows" ) ]
84
+ {
85
+ use std:: os:: windows:: process:: CommandExt ;
86
+ const CREATE_BREAKAWAY_FROM_JOB : u32 = 0x01000000 ;
87
+
88
+ command. creation_flags ( CREATE_BREAKAWAY_FROM_JOB ) ;
89
+ }
90
+
91
+ command. spawn ( ) ?;
79
92
80
93
Ok ( ( ) )
81
94
}
You can’t perform that action at this time.
0 commit comments