[cmake-developers] [PATCH v4 4/4] For Windows encode process output to internally used encoding

Brad King brad.king at kitware.com
Thu Jul 21 13:46:54 EDT 2016


On 07/21/2016 01:36 PM, Dāvis Mosāns wrote:
> Anyway I improved this in places where it was easy, but in some places it's
> more complicated...
> 
> For example
> 
>    while ((p = cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR), p)) {
>      // Put the output in the right place.
>      if (p == cmsysProcess_Pipe_STDOUT && !output_quiet) {
>        if (output_variable.empty()) {
>          cmSystemTools::Stdout(data, length);
> 
> Here we output buffer immediately.
> 
>  while ((out || err) &&
>           (p = cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR), p)) {
>      if (out && p == cmsysProcess_Pipe_STDOUT) {
>        if (!out->Process(data, length)) {

In such cases the data need to be piped through a buffered decoder
that can keep partial fragments around between updates.

Does MultiByteToWideChar or some other API have a way to detect
such boundaries?

-Brad



More information about the cmake-developers mailing list