Skip to content

kwsysProcess: Add kwsysProcess_SetLocale() function

Igor Molchanov requested to merge makise-homura/kwsys:set_locale into master

Created based on discussion in cmake/cmake!6608 (merged).

@brad.king wrote there:

Changes to Source/kwsys/ need to go to upstream KWSys first.

So, I propose these changes by posting this MR. It adds a new function to kwsysProcess:

kwsysEXPORT int kwsysProcess_SetLocale(kwsysProcess* cp, const char* locale);

Set the locale identifier for the child process. The same thing
as setting LC_ALL environment variable. NULL value means don't
set locale at process start. Has no meaning on Windows.
Returns 1 for success and 0 for failure.

This is done because a couple tests from CMake project have problems when ran using language setting different from English. This is due to test outputs being compared to English strings, which comparison obviously fails if this language is set to, e.g. Russian. So processes ran by these tests (they are using cmsysProcess_* functions, which are based on kwsys ones) should have locale set to "C" prior to being run, so messages while testing are generated in correct language and do not fail checks anymore. This is achiveved by using this function.

Edited by Igor Molchanov

Merge request reports