~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: INADA Naoki
  • Date: 2010-02-19 18:33:53 UTC
  • mto: (4634.141.1 2.0-integration)
  • mto: This revision was merged to the branch mainline in revision 5075.
  • Revision ID: songofacandy@gmail.com-20100219183353-93t4qeo7q8i6jzcg
Avoids child process inherits file handles on win32. by using os.fdopen and os.open with O_NOINHERIT instead of builtin open.

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
# OR with 0 on those platforms
78
78
O_BINARY = getattr(os, 'O_BINARY', 0)
79
79
 
 
80
# O_NOINHERIT exists only on win32 too.
 
81
O_NOINHERIT = getattr(os, 'O_NOINHERIT', 0)
 
82
 
80
83
 
81
84
def get_unicode_argv():
82
85
    try:
639
642
def sha_file_by_name(fname):
640
643
    """Calculate the SHA1 of a file by reading the full text"""
641
644
    s = sha()
642
 
    f = os.open(fname, os.O_RDONLY | O_BINARY)
 
645
    f = os.open(fname, os.O_RDONLY | O_BINARY | O_NOINHERIT)
643
646
    try:
644
647
        while True:
645
648
            b = os.read(f, 1<<16)