Просмотр исходного кода

Using tree kill to kill the process (Ubuntu was not exiting)

Berislav 8 лет назад
Родитель
Сommit
7d13b5a7a4
3 измененных файлов с 11 добавлено и 1 удалено
  1. 5 1
      index.js
  2. 5 0
      package-lock.json
  3. 1 0
      package.json

+ 5 - 1
index.js

@@ -1,5 +1,6 @@
 const webdriverio = require('webdriverio');
 const chromedriver = require('chromedriver');
+const kill = require('tree-kill');
 
 // todo: stop works only with 9515
 const port = 9515;
@@ -28,8 +29,11 @@ const client = webdriverio
   .init()
   .on('error', (e) => console.error(e))
   .once('end', () => {
+    console.log('end');
     process.nextTick(function () {
-      chromedriver.stop();
+      console.log('stopping');
+      kill(service.pid);
+      console.log('done');
     });
   })
   .url('https://www.google.com')

+ 5 - 0
package-lock.json

@@ -1176,6 +1176,11 @@
         "punycode": "1.4.1"
       }
     },
+    "tree-kill": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.0.tgz",
+      "integrity": "sha512-DlX6dR0lOIRDFxI0mjL9IYg6OTncLm/Zt+JiBhE5OlFcAR8yc9S7FFXU9so0oda47frdM/JFsk7UjNt9vscKcg=="
+    },
     "tunnel-agent": {
       "version": "0.6.0",
       "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",

+ 1 - 0
package.json

@@ -10,6 +10,7 @@
   "license": "ISC",
   "dependencies": {
     "chromedriver": "^2.35.0",
+    "tree-kill": "^1.2.0",
     "webdriverio": "^4.11.0"
   },
   "devDependencies": {