@codesys/mcp-toolkit 1.4.2 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/scripts/start_session.py +21 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.4.3] - 2025-05-02
|
|
9
|
+
### Fixed
|
|
10
|
+
- Fixed "Cannot import name redirect_stdout" error in session script execution
|
|
11
|
+
- Replaced contextlib.redirect_stdout/redirect_stderr with direct sys.stdout/stderr assignment for IronPython 2.7 compatibility
|
|
12
|
+
- Improved StringIO import handling for better Python 2/3 compatibility
|
|
13
|
+
|
|
8
14
|
## [1.4.2] - 2025-05-02
|
|
9
15
|
### Fixed
|
|
10
16
|
- Enhanced session communication with better logging and debugging
|
|
@@ -236,16 +236,31 @@ def execute_command(command_data):
|
|
|
236
236
|
# This allows us to isolate the script execution somewhat
|
|
237
237
|
local_globals = globals().copy()
|
|
238
238
|
|
|
239
|
-
# Capture output by
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
# Capture output by temporarily replacing stdout/stderr
|
|
240
|
+
# Use custom approach compatible with IronPython 2.7
|
|
241
|
+
try:
|
|
242
|
+
import StringIO as io_module # Python 2.x
|
|
243
|
+
except ImportError:
|
|
244
|
+
import io as io_module # Python 3.x
|
|
245
|
+
|
|
246
|
+
stdout_buffer = io_module.StringIO()
|
|
247
|
+
stderr_buffer = io_module.StringIO()
|
|
242
248
|
|
|
243
|
-
|
|
244
|
-
|
|
249
|
+
# Save original stdout and stderr
|
|
250
|
+
old_stdout = sys.stdout
|
|
251
|
+
old_stderr = sys.stderr
|
|
245
252
|
|
|
246
|
-
with
|
|
253
|
+
# Replace with our buffers
|
|
254
|
+
sys.stdout = stdout_buffer
|
|
255
|
+
sys.stderr = stderr_buffer
|
|
256
|
+
|
|
257
|
+
try:
|
|
247
258
|
# Execute the script
|
|
248
259
|
exec(script, local_globals)
|
|
260
|
+
finally:
|
|
261
|
+
# Restore original stdout and stderr
|
|
262
|
+
sys.stdout = old_stdout
|
|
263
|
+
sys.stderr = old_stderr
|
|
249
264
|
|
|
250
265
|
# Get the captured output
|
|
251
266
|
stdout_output = stdout_buffer.getvalue()
|