[Pkg-javascript-commits] [pdf.js] 75/157: Use taskkill to stop the browser on Windows

David Prévot taffit at moszumanska.debian.org
Tue Aug 11 06:46:39 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 5cce7377afde8e6843199fe647415f1a1c7d3100
Author: Rob Wu <rob at robwu.nl>
Date:   Sat Jul 11 20:08:00 2015 +0200

    Use taskkill to stop the browser on Windows
---
 test/webbrowser.js | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/test/webbrowser.js b/test/webbrowser.js
index c0cf38f..3795e44 100644
--- a/test/webbrowser.js
+++ b/test/webbrowser.js
@@ -24,6 +24,7 @@ var fs = require('fs');
 var path = require('path');
 var spawn = require('child_process').spawn;
 var testUtils = require('./testutils.js');
+var shelljs = require('shelljs');
 
 var tempDirPrefix = 'pdfjs_';
 
@@ -96,7 +97,18 @@ WebBrowser.prototype = {
     }
 
     if (this.process) {
-      this.process.kill('SIGTERM');
+      if (process.platform === 'win32') {
+        // process.kill is not reliable on Windows (Firefox sticks around). The
+        // work-around was to manually open the task manager and terminate the
+        // process. Instead of doing that manually, use taskkill to kill.
+        // (https://technet.microsoft.com/en-us/library/cc725602.aspx)
+        var result = shelljs.exec('taskkill /f /t /pid ' + this.process.pid);
+        if (result.code) {
+          console.error('taskkill failed with exit code ' + result.code);
+        }
+      } else {
+        this.process.kill('SIGTERM');
+      }
     }
   }
 };
@@ -159,4 +171,4 @@ WebBrowser.create = function (desc) {
 };
 
 
-exports.WebBrowser = WebBrowser;
\ No newline at end of file
+exports.WebBrowser = WebBrowser;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list