Skip to content
This repository has been archived by the owner on Aug 7, 2021. It is now read-only.

Commit

Permalink
fix(ns-bundle): escape arguments passed to tns command (#125)
Browse files Browse the repository at this point in the history
When spawning a child process, the arguments should be escape in order
to arguments with special chars (such as spaces) in them to work.

fixes #123
  • Loading branch information
sis0k0 authored Apr 20, 2017
1 parent c06589f commit b9430e3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bin/ns-bundle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (!process.env.npm_config_argv) {
}

const npmArgs = JSON.parse(process.env.npm_config_argv).original;
const tnsArgs = getTnsArgs(npmArgs);
const tnsArgs = getTnsArgs(npmArgs).map(escape);
const flags = npmArgs.filter(a => a.startsWith("--")).map(a => a.substring(2));
const options = getOptions(flags);

Expand All @@ -29,6 +29,10 @@ function getTnsArgs(args) {
return args.filter(a => !other.includes(a));
}

function escape(arg) {
return `"${arg}"`;
}

execute(options);

function execute(options) {
Expand Down

0 comments on commit b9430e3

Please sign in to comment.