@@ -382,16 +382,25 @@ static bool parseJsoncFile(const char* path, bool strictJson)
382382
383383 {
384384 yyjson_read_err error ;
385- instance .state .configDoc = yyjson_read_file (path , strictJson ? 0 : YYJSON_READ_ALLOW_COMMENTS | YYJSON_READ_ALLOW_TRAILING_COMMAS , NULL , & error );
385+ yyjson_read_flag flg = strictJson ? 0 : YYJSON_READ_ALLOW_COMMENTS | YYJSON_READ_ALLOW_TRAILING_COMMAS ;
386+ instance .state .configDoc = path
387+ ? yyjson_read_file (path , flg , NULL , & error )
388+ : yyjson_read_fp (stdin , flg , NULL , & error );
386389 if (!instance .state .configDoc )
387390 {
388391 if (error .code != YYJSON_READ_ERROR_FILE_OPEN )
389392 {
390- size_t row = 0 , col = error .pos ;
391- FF_STRBUF_AUTO_DESTROY content = ffStrbufCreate ();
392- if (ffAppendFileBuffer (path , & content ))
393- yyjson_locate_pos (content .chars , content .length , error .pos , & row , & col , NULL );
394- fprintf (stderr , "Error: failed to parse JSON config file `%s` at (%zu, %zu): %s\n" , path , row , col , error .msg );
393+ if (path )
394+ {
395+ size_t row = 0 , col = error .pos ;
396+ FF_STRBUF_AUTO_DESTROY content = ffStrbufCreate ();
397+ if (ffAppendFileBuffer (path , & content ))
398+ yyjson_locate_pos (content .chars , content .length , error .pos , & row , & col , NULL );
399+ fprintf (stderr , "Error: failed to parse JSON config file `%s` at (%zu, %zu): %s\n" , path , row , col , error .msg );
400+ }
401+ else
402+ fprintf (stderr , "Error: failed to parse JSON from stdin at %zu: %s\n" , error .pos , error .msg );
403+
395404 exit (477 );
396405 }
397406 return false;
@@ -461,6 +470,12 @@ static void optionParseConfigFile(FFdata* data, const char* key, const char* val
461470 if (value [0 ] == '\0' || ffStrEqualsIgnCase (value , "none" ))
462471 return ;
463472
473+ if (value [0 ] == '-' && value [1 ] == '\0' )
474+ {
475+ parseJsoncFile (NULL , false);
476+ return ;
477+ }
478+
464479 //Try to load as an absolute path
465480
466481 FF_STRBUF_AUTO_DESTROY absolutePath = ffStrbufCreateS (value );
0 commit comments