Skip to content

Commit

Permalink
fix errors when specifying zip path with spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
miklcct committed Sep 26, 2024
1 parent 5ef1497 commit 633f945
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/cli/OutputGTFSZipCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ export class OutputGTFSZipCommand implements CLICommand {
// when node tells you it's finished writing a file, it's lying.
setTimeout(() => {
console.log("Writing " + filename);
execSync(`zip -j ${filename} ${argv[3]}/*.txt`);
execSync(`zip -j '${escapeShellArg(filename)}' ${argv[3]}/*.txt`);
}, 1000);
}

}

function escapeShellArg (arg) {
return `'${arg.replace(/'/g, `'\\''`)}'`;
}

0 comments on commit 633f945

Please sign in to comment.