* Only colorise if we are attached to a terminal.
This commit is contained in:
		
							parent
							
								
									b87b9c0d1f
								
							
						
					
					
						commit
						cec2be64f3
					
				
					 1 changed files with 3 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -13,6 +13,8 @@
 | 
			
		|||
#include <ctime>
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
typedef enum {
 | 
			
		||||
    srcNixExprDrvs,
 | 
			
		||||
| 
						 | 
				
			
			@ -711,6 +713,7 @@ static VersionDiff compareVersionAgainstSet(
 | 
			
		|||
 | 
			
		||||
static string colorString(const string & s)
 | 
			
		||||
{
 | 
			
		||||
    if (!isatty(STDOUT_FILENO)) return s;
 | 
			
		||||
    return "\e[1;31m" + s + "\e[0m";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue