mirror of
https://github.com/smogon/sprites.git
synced 2026-07-06 20:24:59 -05:00
sheet: wait for drain on writing entries
This commit is contained in:
parent
c4e6d23454
commit
ca3524b9e3
|
|
@ -40,7 +40,13 @@ const proc = cp.spawn("magick", [
|
|||
|
||||
// Write one at a time to avoid "malloc(): corrupted top size" error
|
||||
for (const entry of sheet.entries) {
|
||||
proc.stdin.write(entry + "\n");
|
||||
if (!proc.stdin.write(entry + "\n")) {
|
||||
// imagick doesn't like it when it receives the input too fast. This
|
||||
// seems to avoid a realloc() invalid next size error.
|
||||
await new Promise(resolve => {
|
||||
proc.stdin.once('drain', resolve);
|
||||
});
|
||||
}
|
||||
}
|
||||
proc.stdin.end();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user