Ticket #188: librun_fix_1_of_1_rev_86d6a197fab7_DBG__added_missing__fflush____after_printing_messages_in__debug_c_.patch

File librun_fix_1_of_1_rev_86d6a197fab7_DBG__added_missing__fflush____after_printing_messages_in__debug_c_.patch, 1.2 KB (added by jan vrany, 6 years ago)
  • debug.c

    # HG changeset patch
    # User Jan Vrany <jan.vrany@fit.cvut.cz>
    # Date 1515020638 0
    #      Wed Jan 03 23:03:58 2018 +0000
    # Branch jv
    # Node ID 86d6a197fab7d3648714a96261b53c72f34ace61
    # Parent  fb4b4836fd7733446acb3e8f2279b46dee91530c
    DBG: added missing `fflush()` after printing messages in `debug.c`
    
    ...as it looks on Windows this is required to get the messages through
    pipes or what (see issue #188)
    
    See https://swing.fit.cvut.cz/projects/stx-jv/ticket/188
    
    diff -r fb4b4836fd77 -r 86d6a197fab7 debug.c
    a b  
    121121                    "    gdb attach %d\n"
    122122                    "\n",
    123123                    pid, pid, pid);
     124    fflush(stderr);   
    124125    kill(pid, SIGSTOP);
    125126#endif
    126127#ifdef USE_WIN32_API
     
    137138                    "    gdb attach %lu\n"
    138139                    "\n",
    139140                    pid, pid);
    140 
     141    fflush(stderr);
    141142    {
    142143        int i = 0;
    143144        while (! IsDebuggerPresent() && (i < secsToWait)) {
     
    147148    }
    148149    if (! IsDebuggerPresent() ) {
    149150        fprintf(stderr, "debugger did not attach in 30mins, terminating()\n");
     151        fflush(stderr);
    150152        exit(0);
    151153    }
    152154#endif