diff --git a/external/.eslintrc b/external/.eslintrc index b60ef2b5e..52a4bc203 100644 --- a/external/.eslintrc +++ b/external/.eslintrc @@ -5,7 +5,6 @@ "env": { "node": true, - "shelljs": true, }, "rules": { diff --git a/external/crlfchecker/crlfchecker.js b/external/crlfchecker/crlfchecker.js deleted file mode 100644 index c136af3bd..000000000 --- a/external/crlfchecker/crlfchecker.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -function checkIfCrlfIsPresent(files) { - var failed = []; - - (ls(files)).forEach(function checkCrlf(file) { - if ((cat(file)).match(/.*\r.*/)) { - failed.push(file); - } - }); - - if (failed.length) { - var errorMessage = - 'Please remove carriage return\'s from\n' + failed.join('\n') + '\n' + - 'Also check your setting for: git config core.autocrlf.'; - - echo(); - echo(errorMessage); - exit(1); - } -} - -exports.checkIfCrlfIsPresent = checkIfCrlfIsPresent; diff --git a/external/crlfchecker/normtext.js b/external/crlfchecker/normtext.js deleted file mode 100644 index bbcd6e89a..000000000 --- a/external/crlfchecker/normtext.js +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright 2012 Mozilla Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -var fs = require('fs'); - -function normalizeText(s) { - return s.replace(/\r\n?/g, '\n').replace(/\uFEFF/g, ''); -} - -var args = process.argv.slice(2); - -args.forEach(function (file) { - var content = fs.readFileSync(file, 'utf8'); - content = normalizeText(content); - fs.writeFileSync(file, content, 'utf8'); -}); diff --git a/package.json b/package.json index d8e7744e2..ada2d0017 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,6 @@ "mkdirp": "^0.5.1", "node-ensure": "^0.0.0", "rimraf": "^2.4.1", - "shelljs": "~0.4.0", "streamqueue": "^1.1.1", "systemjs": "^0.20.7", "systemjs-plugin-babel": "0.0.21", diff --git a/test/.eslintrc b/test/.eslintrc index 692abd312..30cdb53cc 100644 --- a/test/.eslintrc +++ b/test/.eslintrc @@ -5,7 +5,6 @@ "env": { "node": true, - "shelljs": true, "jasmine": true, }, } diff --git a/test/webbrowser.js b/test/webbrowser.js index 570d32874..aa158cd0c 100644 --- a/test/webbrowser.js +++ b/test/webbrowser.js @@ -22,7 +22,6 @@ var fs = require('fs'); var path = require('path'); var spawn = require('child_process').spawn; var testUtils = require('./testutils.js'); -var shelljs = require('shelljs'); var crypto = require('crypto'); var tempDirPrefix = 'pdfjs_'; @@ -141,28 +140,41 @@ WebBrowser.prototype = { var cmdKillAll, cmdCheckAllKilled, isAllKilled; if (process.platform === 'win32') { - var wmicPrefix = 'wmic process where "not Name = \'cmd.exe\' ' + + var wmicPrefix = ['process', 'where', '"not Name = \'cmd.exe\' ' + 'and not Name like \'%wmic%\' ' + - 'and CommandLine like \'%' + this.uniqStringId + '%\'" '; - cmdKillAll = wmicPrefix + 'call terminate'; - cmdCheckAllKilled = wmicPrefix + 'get CommandLine'; + 'and CommandLine like \'%' + this.uniqStringId + '%\'"']; + cmdKillAll = { + file: 'wmic', + args: wmicPrefix.concat(['call', 'terminate']) + }; + cmdCheckAllKilled = { + file: 'wmic', + args: wmicPrefix.concat(['get', 'CommandLine']) + }; isAllKilled = function(exitCode, stdout) { return stdout.indexOf(this.uniqStringId) === -1; }.bind(this); } else { - cmdKillAll = 'pkill -f ' + this.uniqStringId; - cmdCheckAllKilled = 'pgrep -f ' + this.uniqStringId; + cmdKillAll = {file: 'pkill', args: ['-f', this.uniqStringId]}; + cmdCheckAllKilled = {file: 'pgrep', args: ['-f', this.uniqStringId]}; isAllKilled = function(pgrepStatus) { return pgrepStatus === 1; // "No process matched.", per man pgrep. }; } function execAsyncNoStdin(cmd, onExit) { - var proc = shelljs.exec(cmd, { - async: true, - silent: true, - }, onExit); + var proc = spawn(cmd.file, cmd.args, { + shell: true, + stdio: 'pipe', + }); // Close stdin, otherwise wmic won't run. proc.stdin.end(); + var stdout = ''; + proc.stdout.on('data', (data) => { + stdout += data; + }); + proc.on('close', (code) => { + onExit(code, stdout); + }); } var killDateStart = Date.now(); // Note: First process' output it shown, the later outputs are suppressed. @@ -235,7 +247,7 @@ ChromiumBrowser.prototype.buildArguments = function (url) { WebBrowser.create = function (desc) { var name = desc.name; - var path = shelljs.which(desc.path); + var path = fs.realpathSync(desc.path); if (!path) { throw new Error('Browser executable not found: ' + desc.path); }