From 973518a50ed326df15d3d3b6cb310365836f4969 Mon Sep 17 00:00:00 2001 From: Gita Alekhya Paul <54375111+gitaalekhyapaul@users.noreply.github.com> Date: Thu, 13 May 2021 17:44:21 +0530 Subject: [PATCH] fix: update pathname parsing --- lib/nexpect.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/nexpect.js b/lib/nexpect.js index 86c18d3..8fd09ff 100644 --- a/lib/nexpect.js +++ b/lib/nexpect.js @@ -6,6 +6,7 @@ */ var spawn = require('cross-spawn'); var util = require('util'); +var path = require('path'); var AssertionError = require('assert').AssertionError; function chain (context) { @@ -357,9 +358,9 @@ function nspawn (command, params, options) { command = params.shift(); } else if (typeof command === 'string') { - command = command.split(' '); - params = params || command.slice(1); - command = command[0]; + var parsedPath = path.parse(command); + command = path.join(parsedPath.dir, parsedPath.base.split(' ')[0]); + params = params || parsedPath.base.split(' ').splice(1); } options = options || {};