Skip to content

Commit 0a08a8f

Browse files
committed
On Windows, revert to subprocess.run instead of fileutils.run (Unix only)
1 parent f03c91d commit 0a08a8f

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,29 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010
### Added
1111

1212
* RELAP-5 Plugin
13+
* MCNP Plugin
14+
* Serpent Plugin
1315

1416
### Changes
1517

1618
* The `Plugin.__call__` method now allows arbitrary keyword arguments to be
1719
passed on to the `Plugin.run` method
1820
* The `Database` class now acts like a sequence
1921
* Database directory names use random strings to avoid clashes when multiple
20-
instances of WATTS are running simulataneously
22+
instances of WATTS are running simultaneously
2123
* File template-based plugins now accept an `extra_template_inputs` argument
2224
indicating extra template files that should be rendered
2325
* The `PluginOpenMC` class now takes an optional `function` argument that
2426
specifies an arbitrary execution sequence
2527
* All plugins consistently use an attribute `executable` for specifying the path
2628
to an executable
2729

30+
### Fixed
31+
32+
* Use non-blocking pipe when capturing output to avoid some plugins stalling.
33+
* Avoid use of Unix-specific features in the Python standard library when
34+
running on Windows
35+
2836
## [0.2.0]
2937

3038
### Added

src/watts/fileutils.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from contextlib import contextmanager
55
import errno
6-
import fcntl
76
import os
87
import platform
98
import select
@@ -12,6 +11,9 @@
1211
import tempfile
1312
from typing import Union
1413

14+
if sys.platform != 'win32':
15+
import fcntl
16+
1517
# Type for arguments that accept file paths
1618
PathLike = Union[str, bytes, os.PathLike]
1719

@@ -93,6 +95,11 @@ def run(args):
9395
Based on https://stackoverflow.com/a/12272262 and
9496
https://stackoverflow.com/a/7730201
9597
"""
98+
# Windows doesn't support select.select and fcntl module so just default to
99+
# using subprocess.run. In this case, show_output/show_stderr won't work.
100+
if sys.platform == 'win32':
101+
subprocess.run(args)
102+
return
96103

97104
# Helper function to add the O_NONBLOCK flag to a file descriptor
98105
def make_async(fd):

0 commit comments

Comments
 (0)