Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix attributeerror when non-blocking open not supported on windows #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/multitail2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import os
import random
import six
import sys

is_windows = sys.platform == 'win32'

__version__ = "1.5.2"
logger = logging.getLogger(__name__)
Expand All @@ -27,7 +30,8 @@ def _close(self):

def _open(self, path, skip_to_end = True, offset = None):
"""Open `path`, optionally seeking to the end if `skip_to_end` is True."""
fh = os.fdopen(os.open(path, os.O_RDONLY | os.O_NONBLOCK))
flags = os.O_RDONLY if is_windows else (os.O_RDONLY | os.O_NONBLOCK)
fh = os.fdopen(os.open(path, flags))

# If the file is being opened for the first time, jump to the end.
# Otherwise, it is being reopened after a rotation, and we want
Expand Down