~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/interpret.py

  • Committer: William Grant
  • Date: 2009-03-17 07:16:03 UTC
  • Revision ID: grantw@unimelb.edu.au-20090317071603-ux5qxbjkpdarvig3
Tags: 0.1.9.10
ivle.interpret.execute_raw() no longer breaks with lots of data.

Previously we uses subprocess' wait(), which doesn't empty the stdout
pipe. It filled up, causing the child to block. We now use communicate()
instead, which select()s and reads the pipes to unblock things.

Show diffs side-by-side

added added

removed removed

Lines of Context:
439
439
         working_dir, binary] + args,
440
440
        stdin=subprocess.PIPE, stdout=subprocess.PIPE,
441
441
        stderr=subprocess.PIPE, cwd=tramp_dir, close_fds=True)
442
 
    exitcode = proc.wait()
 
442
 
 
443
    (stdout, stderr) = proc.communicate()
 
444
    exitcode = proc.returncode
443
445
 
444
446
    if exitcode != 0:
445
447
        raise ExecutionError('subprocess ended with code %d, stderr %s' %
446
448
                             (exitcode, proc.stderr.read()))
447
 
    return (proc.stdout.read(), proc.stderr.read())
 
449
    return (stdout, stderr)