diff options
author | silverwind <me@silverwind.io> | 2024-02-23 23:07:27 +0100 |
---|---|---|
committer | Earl Warren <contact@earl-warren.org> | 2024-02-26 22:30:26 +0100 |
commit | 7143f8fcdd07571af748c1aa8b01bb2b636389e5 (patch) | |
tree | ddd223edde34f8cfcf0394ee21517396e2c010ea /build | |
parent | Make optional.Option[T] type serializable (#29282) (diff) | |
download | forgejo-7143f8fcdd07571af748c1aa8b01bb2b636389e5.tar.xz forgejo-7143f8fcdd07571af748c1aa8b01bb2b636389e5.zip |
Refactor generate-svg.js (#29348)
Small refactor to avoid `process` global and to sync it with
`generate-images`.
(cherry picked from commit 08c1926e1c3e2487f207b5f225d8b0f2831d0708)
Diffstat (limited to 'build')
-rwxr-xr-x | build/generate-svg.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/build/generate-svg.js b/build/generate-svg.js index 1d92bc0b19..660ac9157e 100755 --- a/build/generate-svg.js +++ b/build/generate-svg.js @@ -4,15 +4,16 @@ import {optimize} from 'svgo'; import {parse} from 'node:path'; import {readFile, writeFile, mkdir} from 'node:fs/promises'; import {fileURLToPath} from 'node:url'; +import {exit} from 'node:process'; const glob = (pattern) => fastGlob.sync(pattern, { cwd: fileURLToPath(new URL('..', import.meta.url)), absolute: true, }); -function exit(err) { +function doExit(err) { if (err) console.error(err); - process.exit(err ? 1 : 0); + exit(err ? 1 : 0); } async function processFile(file, {prefix, fullName} = {}) { @@ -63,7 +64,7 @@ async function main() { } try { - exit(await main()); + doExit(await main()); } catch (err) { - exit(err); + doExit(err); } |