diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-02-23 16:52:01 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-02-23 16:52:01 +0900 |
commit | 130cb6d3f7e8fb24567f053a8f87ef8e077f4c98 (patch) | |
tree | e6916257ed0d48ad5d5ebf4842855dbeeed88489 | |
parent | c8c598b1d63b6a3ab1b14d2b181d47498100bf21 (diff) | |
download | buildstream-tristan/spurious-blockingio-error.tar.gz |
_frontend/cli.py: Clear stdout/stderr fd flags at startuptristan/spurious-blockingio-error
This fixes #929
-rw-r--r-- | buildstream/_frontend/cli.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/buildstream/_frontend/cli.py b/buildstream/_frontend/cli.py index 02ca52e85..f500f8996 100644 --- a/buildstream/_frontend/cli.py +++ b/buildstream/_frontend/cli.py @@ -9,6 +9,7 @@ from .. import _yaml from .._exceptions import BstError, LoadError, AppError from .._versions import BST_FORMAT_VERSION from .complete import main_bashcomplete, complete_path, CompleteUnhandled +import fcntl ################################################################## @@ -170,6 +171,13 @@ def override_completions(orig_args, cmd, cmd_param, args, incomplete): def override_main(self, args=None, prog_name=None, complete_var=None, standalone_mode=True, **extra): + # Clear file status flags, if stdout/stderr is open in non-blocking + # mode for some reason then this can cause BlockingIOError errors + # when trying to write to the file. + # + fcntl.fcntl(sys.stdout.fileno(), fcntl.F_SETFL, 0) + fcntl.fcntl(sys.stderr.fileno(), fcntl.F_SETFL, 0) + # Hook for the Bash completion. This only activates if the Bash # completion is actually enabled, otherwise this is quite a fast # noop. |