@codesys/mcp-toolkit 1.0.4 → 1.0.5

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.
@@ -81,18 +81,13 @@ function executeCodesysScript(scriptContent, codesysExePath, codesysProfileName)
81
81
  process.stderr.write(`Temporary script written to: ${tempFilePath} with latin1 encoding and LF line endings\n`); // Use process.stderr
82
82
  // Add --additionalfolder argument
83
83
  const additionalFolderPath = "C:\\Program Files\\CODESYS 3.5.21.0\\CODESYS\\AdditionalFolders\\Default"; // Assuming Default instance
84
- // Fix: Use shell:false and pass command and arguments separately to properly handle paths with spaces
85
- const command = codesysExePath;
86
- const args = [
87
- `--profile=${codesysProfileName}`,
88
- '--noUI',
89
- `--runscript=${tempFilePath}`
90
- ];
91
- process.stderr.write(`Executing: ${command} ${args.join(' ')}\n`); // Log the command
92
- // Spawn the CODESYS process using shell:false for proper path handling with spaces
93
- const codesysProcess = (0, child_process_1.spawn)(command, args, {
84
+ // Fix: Use shell:true but ensure proper quoting for paths with spaces
85
+ const commandWithArgs = `"${codesysExePath}" --profile="${codesysProfileName}" --noUI --runscript="${tempFilePath}"`;
86
+ process.stderr.write(`Executing: ${commandWithArgs}\n`); // Log the command
87
+ // Spawn the CODESYS process with shell:true for compatibility with CODESYS argument parsing
88
+ const codesysProcess = (0, child_process_1.spawn)(commandWithArgs, {
94
89
  stdio: ['ignore', 'pipe', 'pipe'], // Ignore stdin, pipe stdout and stderr
95
- shell: false // Don't use shell to avoid issues with paths containing spaces
90
+ shell: true // Keep shell:true but with properly quoted paths
96
91
  });
97
92
  // Capture stdout
98
93
  codesysProcess.stdout.on('data', (data) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codesys/mcp-toolkit",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "main": "dist/server.js",
5
5
  "bin": {
6
6
  "codesys-mcp-toolkit": "./dist/bin.js"