Skip to content

Commit

Permalink
Merge pull request #674 from macbre/issue-672-absolute-path-check
Browse files Browse the repository at this point in the history
Be platform agnostic and use fs.isAbsolute()
  • Loading branch information
macbre authored Nov 24, 2016
2 parents b098c33 + f5f9aa2 commit 058e179
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/phantomas.js
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,7 @@ phantomas.prototype = {
// tries to parse it's output (assumes JSON formatted output)
runScript: function(script, args, callback) {
var execFile = require("child_process").execFile,
fs = require('fs'),
osName = require('system').os.name, // linux / windows
start = Date.now(),
self = this;
Expand All @@ -858,8 +859,8 @@ phantomas.prototype = {
// @see https://github.com/ariya/phantomjs/wiki/API-Reference-ChildProcess
args = args || [];

// handle relative paths to binaries
if (script.indexOf('/') !== 0) {
// handle relative paths to binaries (issue #672)
if (!fs.isAbsolute(script)) {
script = this.dir + script;
}

Expand Down

0 comments on commit 058e179

Please sign in to comment.