Skip to content

Commit 0d9d4ef

Browse files
committed
partially refactor function returned by Run function (utility.ts)
1 parent b749cc1 commit 0d9d4ef

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/utility.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ export function Run(
8888
let regexpCommands = /"((?:\\.|[^"\\])*)"/g;
8989
let commands = command.match(regexpCommands) || [];
9090
for (command of commands) {
91-
args.push(normalize(command.replace(/(\/|\\)/g, sep)));
91+
const arg = command.replace(/(\/|\\)/g, sep);
92+
args.push(normalize(arg));
9293
}
9394

9495
// Special treatment for the output switch because it is exposed as a
@@ -98,12 +99,8 @@ export function Run(
9899

99100
if (output) {
100101
args.pop();
101-
args.push(
102-
normalize(output[0].replace(
103-
/(\/|\\|")/g,
104-
(match) => match === '"' ? '' : sep)
105-
)
106-
);
102+
const arg = output[0].replace(/(\/|\\|")/g, (match) => match === '"' ? '' : sep);
103+
args.push(normalize(arg));
107104
}
108105

109106
if (switches.files) {

0 commit comments

Comments
 (0)