Skip to content

Commit d3ce72d

Browse files
committed
partially refactor function returned by Run function (utility.ts)
1 parent 012b1de commit d3ce72d

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/utility.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,9 @@ export function Run(
8686
let args = [command.split(' ')[0]];
8787
// Parse and add command (non-switches parameters) to `args`.
8888
let regexpCommands = /"((?:\\.|[^"\\])*)"/g;
89-
let commands = command.match(regexpCommands);
90-
91-
if (commands) {
92-
commands.forEach(function (c) {
93-
c = c.replace(/\//g, sep);
94-
c = c.replace(/\\/g, sep);
95-
c = normalize(c);
96-
args.push(c);
97-
});
89+
let commands = command.match(regexpCommands) || [];
90+
for (command of commands) {
91+
args.push(normalize(command.replace(/(\/|\\)/g, sep)));
9892
}
9993

10094
// Special treatment for the output switch because it is exposed as a

0 commit comments

Comments
 (0)