File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -273,11 +273,17 @@ def get_fontconfig_fonts(fontext='ttf'):
273
273
274
274
fontfiles = {}
275
275
try :
276
- warnings .warn ('Matplotlib is building the font cache using fc-list. This may take a moment.' )
277
276
pipe = subprocess .Popen (['fc-list' , '--format=%{file}\\ n' ],
278
277
stdout = subprocess .PIPE ,
279
278
stderr = subprocess .PIPE )
280
- output = pipe .communicate ()[0 ]
279
+ # We emit a warning if the process has not completed after 5 seconds.
280
+ # We avoid showing it before since if this takes < 5 seconds, the user
281
+ # probably won't notice.
282
+ try :
283
+ output = pipe .communicate (timeout = 5 )[0 ]
284
+ except subprocess .Timeout :
285
+ warnings .warn ('Matplotlib is building the font cache using fc-list. This may take a moment.' )
286
+ output = pipe .communicate ()[0 ]
281
287
except (OSError , IOError ):
282
288
# Calling fc-list did not work, so we'll just return nothing
283
289
return fontfiles
You can’t perform that action at this time.
0 commit comments