Handle non-ASCII output encoded as ASCII
Some tool involved in `brew install node` is emitting UTF-8 even though LANG and LC_ALL are unset. Since the external encoding is US-ASCII, we need to guard against bad data here.
This commit is contained in:
		
							parent
							
								
									4b07dbbf78
								
							
						
					
					
						commit
						03488424cb
					
				@ -522,7 +522,11 @@ if ARGV.include? "--junit"
 | 
			
		||||
      failure = testcase.add_element 'failure' if step.failed?
 | 
			
		||||
      if step.has_output?
 | 
			
		||||
        # Remove invalid XML CData characters from step output.
 | 
			
		||||
        output = REXML::CData.new step.output.delete("\000\a\b\e\f")
 | 
			
		||||
        output = step.output
 | 
			
		||||
        if output.respond_to?(:force_encoding) && !output.valid_encoding?
 | 
			
		||||
          output.force_encoding(Encoding::UTF_8)
 | 
			
		||||
        end
 | 
			
		||||
        output = REXML::CData.new output.delete("\000\a\b\e\f")
 | 
			
		||||
        if step.passed?
 | 
			
		||||
          system_out = testcase.add_element 'system-out'
 | 
			
		||||
          system_out.text = output
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user