File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,22 @@ abstract class Browser {
108108 /// exceptions.
109109 Future close () {
110110 _closed = true ;
111- _process.then ((process) => process.kill ());
111+
112+ _process.then ((process) {
113+ // Dartium has a difficult time being killed on Linux. To ensure it is
114+ // properly closed, find all children processes and kill those first.
115+ try {
116+ if (Platform .isLinux) {
117+ var result = Process .runSync ('pgrep' , ['-P' , '${process .pid }' ]);
118+ for (var pid in '${result .stdout }' .split ('\n ' )) {
119+ Process .runSync ('kill' , ['-9' , pid]);
120+ }
121+ }
122+ } catch (e) {
123+ print ('Failed to kill browser children: $e ' );
124+ }
125+ process.kill ();
126+ });
112127
113128 // Swallow exceptions. The user should explicitly use [onExit] for these.
114129 return onExit.catchError ((_) {});
You can’t perform that action at this time.
0 commit comments