# -*- coding: utf-8 -*-

from powerline.theme import requires_segment_info


@requires_segment_info
def last_status(segment_info):
	'''Return last exit code.'''
	if not segment_info.last_exit_code:
		return None
	return [{'contents': str(segment_info.last_exit_code), 'highlight_group': 'exit_fail'}]


@requires_segment_info
def last_pipe_status(segment_info):
	'''Return last pipe status.'''
	if any(segment_info.last_pipe_status):
		return [{"contents": str(status), "highlight_group": "exit_fail" if status else "exit_success"}
			for status in segment_info.last_pipe_status]
	else:
		return None

# -*- coding: utf-8 -*-

from powerline.theme import requires_segment_info


@requires_segment_info
def last_status(segment_info):
	'''Return last exit code.'''
	return str(segment_info.last_exit_code) if segment_info.last_exit_code else None


@requires_segment_info
def last_pipe_status(segment_info):
	'''Return last pipe status.'''
	if any(segment_info.last_pipe_status):
		return [{"contents": str(status), "highlight_group": "exit_fail" if status else "exit_success"}
			for status in segment_info.last_pipe_status]
	else:
		return None

--- 
+++ 
@@ -6,7 +6,9 @@
 @requires_segment_info
 def last_status(segment_info):
 	'''Return last exit code.'''
-	return str(segment_info.last_exit_code) if segment_info.last_exit_code else None
+	if not segment_info.last_exit_code:
+		return None
+	return [{'contents': str(segment_info.last_exit_code), 'highlight_group': 'exit_fail'}]
 
 
 @requires_segment_info
Use exit_fail hl group for last_status segment

Fixes #270
