1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2025-11-23 21:34:49 +02:00

Catch Ctrl+C keys to abort execution in scripts (#12852)

This commit is contained in:
Álvaro Mondéjar Rubio
2025-03-06 04:05:36 +01:00
committed by GitHub
parent f4ac11daca
commit 4a368d8ef5
2 changed files with 16 additions and 0 deletions

View File

@@ -28,6 +28,14 @@ import {
writeIconsData,
} from './utils.js';
// Ctrl+C to abort
process.stdin.on('data', (key) => {
if (key.toString() === '\u0003') {
process.stdout.write('Aborted\n');
process.exit(1);
}
});
/** @type {import('../sdk.js').IconData[]} */
const iconsData = JSON.parse(await getIconsDataString());
const jsonSchema = await getJsonSchemaData();

View File

@@ -17,6 +17,14 @@ const __dirname = getDirnameFromImportMeta(import.meta.url);
const rootDirectory = path.resolve(__dirname, '..');
const svgFilesDirectory = path.resolve(rootDirectory, 'icons');
// Ctrl+C to abort
process.stdin.on('data', (key) => {
if (key.toString() === '\u0003') {
process.stdout.write('Aborted\n');
process.exit(1);
}
});
const iconsData = await getIconsData();
const icons = iconsData.map((icon, index) => {
const slug = getIconSlug(icon);