1. Michał Górny
  2. smart-live-rebuild

Commits

Michał Górny  committed 1f170ea

Use system encoding for VCS call() results. Ignore errors.

  • Participants
  • Parent commits edb4b04
  • Branches master

Comments (0)

Files changed (2)

File SmartLiveRebuild/core.py

View file
 					raise
 			else:
 				try:
+					# the environment file should be utf8-encoded
 					spl = l.decode('utf8').split('\0')
 				except UnicodeError:
 					# got stuck in the middle of a character?

File SmartLiveRebuild/vcs/__init__.py

View file
 # (c) 2010 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 3-clause BSD license or the GPL-2 license.
 
-import os, subprocess, sys
+import locale, os, subprocess, sys
 
 from SmartLiveRebuild.output import out
 
 	@staticmethod
 	def call(cmd):
 		p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
-		ret = p.communicate()[0].decode('utf8')
+		ret = p.communicate()[0].decode(locale.getpreferredencoding(), 'replace')
 		if p.wait() != 0:
 			raise SystemError('Command failed: %s' % cmd)
 		return ret