# Path: auto_forensicate/errors.py
# class BadConfigOption(Exception):
# class ForensicateError(Exception):
# class RecipeException(Exception):
# class RetryableError(ForensicateError):


import io
import logging
import os
import shutil
import subprocess
import sys
import tempfile
import six
from auto_forensicate import errors
    """
    super(ProcessOutputArtifact, self).__init__(os.path.basename(path))
    self.remote_path = path
    self._buffered_content = None
    self._command = command
    self._ignore_failure = ignore_failure

  def _RunCommand(self):
    """Run a command.

    Returns:
      bytes: the command output, or an error if it failed to run.
    """
    command_output = ''
    process = subprocess.Popen(
        self._command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    self._logger.info('Running command \'%s\'', self._command)
    output, error = process.communicate()

    if process.returncode == 0:
      command_output = output
      self._logger.info('Command %s terminated.', self._command)
      self._logger.debug('stderr : \'%s\'', error.strip())
    else:
      command_output = (
          'Command \'{0!s}\' failed with \'{1!s}\' return code {2:d})'.format(
              self._command, error.strip(), process.returncode))
      self._logger.error(command_output)
      command_output = command_output.encode()
      if not self._ignore_failure:

# Path: auto_forensicate/errors.py
# class BadConfigOption(Exception):
# class ForensicateError(Exception):
# class RecipeException(Exception):
# class RetryableError(ForensicateError):


# Path: auto_forensicate/recipes/base.py
import io
import logging
import os
import shutil
import subprocess
import sys
import tempfile
import six
from auto_forensicate import errors

    """
    super(ProcessOutputArtifact, self).__init__(os.path.basename(path))
    self.remote_path = path
    self._buffered_content = None
    self._command = command
    self._ignore_failure = ignore_failure

  def _RunCommand(self):
    """Run a command.

    Returns:
      bytes: the command output, or an error if it failed to run.
    """
    command_output = ''
    process = subprocess.Popen(
        self._command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    self._logger.info('Running command \'%s\'', self._command)
    output, error = process.communicate()

    if process.returncode == 0:
      command_output = output
      self._logger.info('Command %s terminated.', self._command)
      self._logger.debug('stderr : \'%s\'', error.strip())
    else:
      command_output = (
          'Command \'{0!s}\' failed with \'{1!s}\' return code {2:d})'.format(
              self._command, error.strip(), process.returncode))
      self._logger.error(command_output)
      command_output = command_output.encode()
      if not self._ignore_failure:

        raise errors.RecipeException(