appengine_django/tests/commands_test.py
def runCommand(self, command, args=None, int_after=None, input=None):
    """Helper to run the specified command in a child process.

    Args:
      command: The name of the command to run.
      args: List of command arguments to run the command with.
      int_after: If set to a positive integer, SIGINT will be sent to the
        running child process after this many seconds to cause an exit. This
        should be less than the COMMAND_TIMEOUT value (10 seconds).
      input: A string to write to stdin when the command starts. stdin is
        closed after the string is written.

    Returns:
      rc: The integer return code of the process.
      output: A string containing the childs output.
    """
    if not args:
      args = []
    start = time.time()
    int_sent = False
    fd = subprocess.PIPE

    child = subprocess.Popen([sys.executable, "manage.py", command] + args,
                             stdin=fd, stdout=fd, stderr=fd, cwd=os.getcwdu())
    if input:
      child.stdin.write(input)
      child.stdin.close()

    while 1:
      rc = child.poll()
      if rc is not None:
        # Child has exited.
        break
      elapsed = time.time() - start
      if int_after and int_after > 0 and elapsed > int_after and not int_sent:
        # Sent SIGINT as requested, give child time to exit cleanly.
        os.kill(child.pid, signal.SIGINT)
        start = time.time()
        int_sent = True
        continue
      if elapsed < self.COMMAND_TIMEOUT:
        continue
      # Command is over time, kill and exit loop.
      os.kill(child.pid, signal.SIGKILL)
      time.sleep(2)  # Give time for the signal to be received.
      break

    # Return status and output.
    return rc, child.stdout.read(), child.stderr.read()
Helper to run the specified command in a child process.

    Args:
      command: The name of the command to run.
      args: List of command arguments to run the command with.
      int_after: If set to a positive integer, SIGINT will be sent to the
        running child process after this many seconds to cause an exit. This
        should be less than the COMMAND_TIMEOUT value (10 seconds).
      input: A string to write to stdin when the command starts. stdin is
        closed after the string is written.

    Returns:
      rc: The integer return code of the process.
      output: A string containing the childs output.
    
Helper to run the specified command in a child process.
Helper to run the specified command in a child process .
def runCommand(self, command, args=None, int_after=None, input=None):
    if not args:
      args = []
    start = time.time()
    int_sent = False
    fd = subprocess.PIPE
    child = subprocess.Popen([sys.executable, "manage.py", command] + args,
                             stdin=fd, stdout=fd, stderr=fd, cwd=os.getcwdu())
    if input:
      child.stdin.write(input)
      child.stdin.close()
    while 1:
      rc = child.poll()
      if rc is not None:
        break
      elapsed = time.time() - start
      if int_after and int_after > 0 and elapsed > int_after and not int_sent:
        os.kill(child.pid, signal.SIGINT)
        start = time.time()
        int_sent = True
        continue
      if elapsed < self.COMMAND_TIMEOUT:
        continue
      os.kill(child.pid, signal.SIGKILL)
      time.sleep(2)  
      break
    return rc, child.stdout.read(), child.stderr.read()
def runCommand ( self , command , args = None , int_after = None , input = None ) : if not args : args = [ ] start = time . time ( ) int_sent = False fd = subprocess . PIPE child = subprocess . Popen ( [ sys . executable , "manage.py" , command ] + args , stdin = fd , stdout = fd , stderr = fd , cwd = os . getcwdu ( ) ) if input : child . stdin . write ( input ) child . stdin . close ( ) while 1 : rc = child . poll ( ) if rc is not None : break elapsed = time . time ( ) - start if int_after and int_after > 0 and elapsed > int_after and not int_sent : os . kill ( child . pid , signal . SIGINT ) start = time . time ( ) int_sent = True continue if elapsed < self . COMMAND_TIMEOUT : continue os . kill ( child . pid , signal . SIGKILL ) time . sleep ( 2 ) break return rc , child . stdout . read ( ) , child . stderr . read ( )
Helper to run the specified command in a child process.
Helper to run the specified command in a child process .
"""Helper to run the specified command in a child process.

    Args:
      command: The name of the command to run.
      args: List of command arguments to run the command with.
      int_after: If set to a positive integer, SIGINT will be sent to the
        running child process after this many seconds to cause an exit. This
        should be less than the COMMAND_TIMEOUT value (10 seconds).
      input: A string to write to stdin when the command starts. stdin is
        closed after the string is written.

    Returns:
      rc: The integer return code of the process.
      output: A string containing the childs output.
    """ # Child has exited. # Sent SIGINT as requested, give child time to exit cleanly. # Command is over time, kill and exit loop. # Give time for the signal to be received. # Return status and output.
The integer return code of the process.
output: A string containing the childs output.
The integer return code of the process . output : A string containing the childs output .
rc
self
command
The name of the command to run.
The name of the command to run .
args
List of command arguments to run the command with.
List of command arguments to run the command with .
int_after
If set to a positive integer, SIGINT will be sent to the
running child process after this many seconds to cause an exit. This
should be less than the COMMAND_TIMEOUT value (10 seconds).
If set to a positive integer SIGINT will be sent to the running child process after this many seconds to cause an exit . This should be less than the COMMAND_TIMEOUT value ( 10 seconds ) .
input
A string to write to stdin when the command starts. stdin is
closed after the string is written.
A string to write to stdin when the command starts . stdin is closed after the string is written .