- sha1+':status-config.json'],
- stdout=subprocess.PIPE).stdout
- fp = codecs.getreader(encoding=encoding)(stream=fp_byte_stream)
-
- return json.load(fp)
+ '{}:{}'.format(sha1, filename)],
+ stdout=subprocess.PIPE)
+ config_bytes, err = p.communicate()
+ status = p.wait()
+ if status != 0:
+ raise ConfigError(
+ ("Missing status-config.json in branch '{branch}' of"
+ '{nmbgit}. Add the file or explicitly set --config.'
+ ).format(branch=branch, nmbgit=nmbhome))
+
+ config_json = config_bytes.decode(encoding)
+ try:
+ return json.loads(config_json)
+ except ValueError as e:
+ if not path:
+ path = "{} in branch '{}' of {}".format(
+ filename, branch, nmbhome)
+ raise ConfigError(
+ 'Could not parse JSON from the config file {}:\n{}'.format(
+ path, e))