Skip to content

Commit 8a3cd51

Browse files
committed
Simplify single quote escaping
1 parent 6ad0eb8 commit 8a3cd51

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

entry.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ const PRETTIER_OPTIONS = [
3333
const run = (...args: string[]) =>
3434
new Promise<string>((resolve, reject) => {
3535
exec(
36-
// https://stackoverflow.com/a/7685469
37-
args.map(arg => `"${arg.replace(/(["'$`\\])/g, "\\$1")}"`).join(" "),
36+
args.map(arg => `'${arg.replace(/'/g, "'\"'\"'")}'`).join(" "),
3837
{ maxBuffer: Infinity },
3938
(ex, stdout, stderr) => (ex ? reject : resolve)(stdout + stderr),
4039
);

0 commit comments

Comments
 (0)