Ignore:
Timestamp:
Mar 27, 2018, 4:05:17 PM (7 years ago)
Author:
bird
Message:

kmk/win: Windows kmk now defaults to --output-sync=target. Fixed output sync on windows in nested make processes that got busted by winchildren and it's no inheritance policy.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/output.c

    r3193 r3194  
    9494      void *sem = acquire_semaphore ();
    9595
     96# ifndef KMK /* this drives me bananas. */
    9697      /* Log the working directory for this dump.  */
    9798      if (print_directory_flag && output_sync != OUTPUT_SYNC_RECURSE)
    9899        traced = log_working_directory (1);
     100# endif
    99101
    100102      /* Work the out and err sequences in parallel. */
     
    124126            fflush(prevdst);
    125127          prevdst = dst;
    126 #ifdef KBUILD_OS_WINDOWS
     128# ifdef KBUILD_OS_WINDOWS
    127129          maybe_con_fwrite (src, len, 1, dst);
    128 #else
     130# else
    129131          fwrite (src, len, 1, dst);
    130 #endif
     132# endif
    131133        }
    132134      if (prevdst)
    133135        fflush (prevdst);
    134136
     137# ifndef KMK /* this drives me bananas. */
    135138      if (traced)
    136139        log_working_directory (0);
     140# endif
    137141
    138142      /* Exit the critical section.  */
     
    599603
    600604#ifdef WINDOWS32
     605# ifdef CONFIG_NEW_WIN_CHILDREN
     606  if (STREAM_OK (stdout))
     607    {
     608      if (STREAM_OK (stderr))
     609        {
     610          char mtxname[256];
     611          sync_handle = create_mutex (mtxname, sizeof (mtxname));
     612          if (sync_handle != -1)
     613            {
     614              prepare_mutex_handle_string (mtxname);
     615              return same_stream (stdout, stderr);
     616            }
     617          perror_with_name ("output-sync suppressed: ", "create_mutex");
     618        }
     619      else
     620        perror_with_name ("output-sync suppressed: ", "stderr");
     621    }
     622  else
     623    perror_with_name ("output-sync suppressed: ", "stdout");
     624  output_sync = OUTPUT_SYNC_NONE;
     625
     626# else  /* !CONFIG_NEW_WIN_CHILDREN */
    601627  if ((!STREAM_OK (stdout) && !STREAM_OK (stderr))
    602628      || (sync_handle = create_mutex ()) == -1)
     
    610636      prepare_mutex_handle_string (sync_handle);
    611637    }
     638# endif /* !CONFIG_NEW_WIN_CHILDREN */
    612639
    613640#else
     
    10321059#endif
    10331060
     1061#ifndef KMK
    10341062  /* If we're not syncing this output per-line or per-target, make sure we emit
    10351063     the "Entering..." message where appropriate.  */
    10361064  if (output_sync == OUTPUT_SYNC_NONE || output_sync == OUTPUT_SYNC_RECURSE)
     1065#else
     1066  /* Indiscriminately output "Entering..." and "Leaving..." message for each
     1067     command line or target is plain annoying!  And when there is no recursion
     1068     it's actually inappropriate.   Haven't got a simple way of detecting that,
     1069     so back to the old behavior for now.  [bird] */
     1070#endif
    10371071    if (! stdio_traced && print_directory_flag)
    10381072      stdio_traced = log_working_directory (1);
Note: See TracChangeset for help on using the changeset viewer.