schriftgestalt / FontMakeExportPlugin

Glyphs export plugin that uses fontmake
Apache License 2.0
24 stars 4 forks source link

Write subprocess output to macro panel in real-time #7

Closed anthrotype closed 11 months ago

anthrotype commented 11 months ago

Running fontmake can take a while (and the Glyphs UI blocks while it's running), so instead of staring at the beachball for minutes, I think it's better that we print fontmake's logging output directly to the Macro output panel at the same time that it is being emitted by fontmake, rather than capturing the output and only printing it when it has finished.

Also, I make so that the Macro panel is placed in front automatically whenever the subprocess is executed, which I think improves usability.

Finally, note that Python logging (used by fontmake) prints to stderr and fontmake never uses print() function so it doesn't print to stdout; thus, the fact that you may have see some stderr does not actually entail that you have some error; one needs to check the subprocess returncode (== 0 means success, != 0 means error, like any command run from the console). For this reason, I no longer care about distinguishing between stdout/stderr, but I simply redirect stderr to stdout and print the lines as they come (just like you'd see them if you run fontmake on the command line).