@@ -691,9 +691,11 @@ static void walkHandle(uv_handle_t* h, void* arg) {
691691
692692 *out << std::left << " [" << (uv_has_ref (h) ? ' R' : ' -' )
693693 << (uv_is_active (h) ? ' A' : ' -' ) << " ] " << std::setw (10 ) << type
694- << std::internal << std::setw (2 + 2 * sizeof (void *)) << std::setfill (' 0' )
695- << static_cast <void *>(h) << std::left << std::setfill (' ' ) << " "
696- << std::left << data.str () << std::endl;
694+ << std::internal << std::setw (2 + 2 * sizeof (void *));
695+ char prev_fill = out->fill (' 0' );
696+ *out << static_cast <void *>(h) << std::left;
697+ out->fill (prev_fill);
698+ *out << " " << std::left << data.str () << std::endl;
697699}
698700
699701static void WriteNodeReport (Isolate* isolate, DumpEvent event, const char * message, const char * location, char * filename, std::ostream &out, TIME_TYPE* tm_struct) {
@@ -704,6 +706,10 @@ static void WriteNodeReport(Isolate* isolate, DumpEvent event, const char* messa
704706 pid_t pid = getpid ();
705707#endif
706708
709+ // Save formatting for output stream.
710+ std::ios oldState (nullptr );
711+ oldState.copyfmt (out);
712+
707713 // File stream opened OK, now start printing the report content, starting with the title
708714 // and header information (event, filename, timestamp and pid)
709715 out << " ================================================================================\n " ;
@@ -779,6 +785,9 @@ static void WriteNodeReport(Isolate* isolate, DumpEvent event, const char* messa
779785 out << " \n ================================================================================\n " ;
780786 out << std::flush;
781787
788+ // Restore output stream formatting.
789+ out.copyfmt (oldState);
790+
782791 report_active = false ;
783792}
784793
0 commit comments