diff --git a/src/content-render/scripts/reconcile-filenames-with-ids.js b/src/content-render/scripts/reconcile-filenames-with-ids.js index 0ed4e15116..c2bb0fe504 100755 --- a/src/content-render/scripts/reconcile-filenames-with-ids.js +++ b/src/content-render/scripts/reconcile-filenames-with-ids.js @@ -15,7 +15,7 @@ import walk from 'walk-sync' import GithubSlugger from 'github-slugger' import { decode } from 'html-entities' import frontmatter from '#src/frame/lib/read-frontmatter.js' -import { execSync } from 'child_process' +import { execFileSync } from 'child_process' import addRedirectToFrontmatter from '#src/redirects/scripts/helpers/add-redirect-to-frontmatter.js' const slugger = new GithubSlugger() @@ -60,13 +60,13 @@ contentFiles.forEach((oldFullPath) => { const oldContentPath = path.relative(process.cwd(), oldFullPath) const newContentPath = path.relative(process.cwd(), newFullPath) - const gitStatusOfFile = execSync(`git status --porcelain ${oldContentPath}`).toString() + const gitStatusOfFile = execFileSync('git', ['status', '--porcelain', oldContentPath]).toString() // if file is untracked, do a regular mv; otherwise do a git mv if (gitStatusOfFile.includes('??')) { - execSync(`mv ${oldContentPath} ${newContentPath}`) + execFileSync('git', ['mv', oldContentPath, newContentPath]) } else { - execSync(`git mv ${oldContentPath} ${newContentPath}`) + execFileSync('git', ['mv', oldContentPath, newContentPath]) } // then add the old path to the redirect_from frontmatter