Filter ANSI colors when not writing to a terminal
Fixes https://github.com/NixOS/nixpkgs/issues/37114.
This commit is contained in:
		
							parent
							
								
									7b8914825a
								
							
						
					
					
						commit
						4868721506
					
				
					 4 changed files with 10 additions and 8 deletions
				
			
		|  | @ -1185,7 +1185,7 @@ void ignoreException() | |||
| } | ||||
| 
 | ||||
| 
 | ||||
| std::string filterANSIEscapes(const std::string & s, unsigned int width) | ||||
| std::string filterANSIEscapes(const std::string & s, bool filterAll, unsigned int width) | ||||
| { | ||||
|     std::string t, e; | ||||
|     size_t w = 0; | ||||
|  | @ -1210,7 +1210,7 @@ std::string filterANSIEscapes(const std::string & s, unsigned int width) | |||
|                 if (i != s.end() && *i >= 0x40 && *i <= 0x5f) e += *i++; | ||||
|             } | ||||
| 
 | ||||
|             if (last == 'm') | ||||
|             if (!filterAll && last == 'm') | ||||
|                 t += e; | ||||
|         } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue