Bug 1770791 - Remove duplicate initialization in python glean package #2064
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
for bug 1770791
On Windows, Creating
FdLogger
twice causes the subsequentsubprocess
operation somehow fail.And apparently the duplicate initialization is completely unnecessary.
So, applied 2 fixes, both on Rust side and Python side.
Rust side's
glean_enable_logging_to_fd
usesOnceCell
to prevent subsequent call overwriting the value,but
fd_logger::FdLogger::new(fd)
is not guarded.So, it should check
FD_LOGGER.get().is_some()
beforefd_logger::FdLogger::new(fd)
.Python side calls
setup_logging
twice, first time from_ffi.py
top-level, and second time fromglean.py
top-level.Either of them should be removed, and I've removed the former one.
The attached testcase fails on windows, with
py.test -s tests/test_subprocess.py
.the
-s
option seems to be necessary to hit the problematic case.