import os
import subprocess

from ..platform_name import platform_name

if platform_name() == 'windows':
    from .windows import *
else:
    from .posix import *


class shell_list(list):
    """A special subclass of list used to mark that this command line uses
    special shell characters."""
    pass


def execute(args, shell=False, env=None, quiet=False):
    if quiet:
        devnull = open(os.devnull, 'wb')
    try:
        return subprocess.check_output(
            args, universal_newlines=True, shell=shell, env=env
        )
    except:
        if quiet:
            devnull.close()
        raise

import os
import subprocess

from ..platform_name import platform_name

if platform_name() == 'windows':
    from .windows import *
else:
    from .posix import *


class shell_list(list):
    """A special subclass of list used to mark that this command line uses
    special shell characters."""
    pass


def execute(args, shell=False, env=None, quiet=False):
    stderr = None
    if quiet:
        stderr = open(os.devnull, 'wb')
    try:
        return subprocess.check_output(
            args, universal_newlines=True, shell=shell, env=env, stderr=stderr
        )
    except:
        if quiet:
            stderr.close()
        raise

Fix "quiet" mode for shell.execute()
Fix "quiet" mode for shell.execute()

  import os
  import subprocess
  
  from ..platform_name import platform_name
  
  if platform_name() == 'windows':
      from .windows import *
  else:
      from .posix import *
  
  
  class shell_list(list):
      """A special subclass of list used to mark that this command line uses
      special shell characters."""
      pass
  
  
  def execute(args, shell=False, env=None, quiet=False):
+     stderr = None
      if quiet:
-         devnull = open(os.devnull, 'wb')
+         stderr = open(os.devnull, 'wb')
      try:
          return subprocess.check_output(
-             args, universal_newlines=True, shell=shell, env=env
+             args, universal_newlines=True, shell=shell, env=env, stderr=stderr
          )
      except:
          if quiet:
-             devnull.close()
+             stderr.close()
          raise
  
Fix "quiet" mode for shell.execute()
## Code Before:
import os
import subprocess

from ..platform_name import platform_name

if platform_name() == 'windows':
    from .windows import *
else:
    from .posix import *


class shell_list(list):
    """A special subclass of list used to mark that this command line uses
    special shell characters."""
    pass


def execute(args, shell=False, env=None, quiet=False):
    if quiet:
        devnull = open(os.devnull, 'wb')
    try:
        return subprocess.check_output(
            args, universal_newlines=True, shell=shell, env=env
        )
    except:
        if quiet:
            devnull.close()
        raise

## Instruction:
Fix "quiet" mode for shell.execute()
## Code After:
import os
import subprocess

from ..platform_name import platform_name

if platform_name() == 'windows':
    from .windows import *
else:
    from .posix import *


class shell_list(list):
    """A special subclass of list used to mark that this command line uses
    special shell characters."""
    pass


def execute(args, shell=False, env=None, quiet=False):
    stderr = None
    if quiet:
        stderr = open(os.devnull, 'wb')
    try:
        return subprocess.check_output(
            args, universal_newlines=True, shell=shell, env=env, stderr=stderr
        )
    except:
        if quiet:
            stderr.close()
        raise
