thanks for updating the MR
overall looks good to me
but I don't like having a global variable holding the current code page:
* means that we need to keep synchronisation of cache wrt. real status * note that a background app could change console code page, so changing code page upon external process execution covers most of the aspects (eg invokind 'chcp'), but not all of them
the reason for slowdown (even timeout in running the tests), comes from the label finding routines that have to rescan potentially the whole batch file, hence calling a zillions on time WCMD_fgets() (almost 3 millions calls when running the non regression tests)
calling once GetConsoleOutputCP() before each label search (instead of once call for every line in every search) solves the speed issue
see attached mbox for an example
would you mind using this instead?
[confactor.patch](/uploads/3cac3d52c288797edbe080f36950774e/confactor.patch)