hupilot-shell-host 1.0.0 → 1.0.1

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.
@@ -10,6 +10,12 @@ const MAX_OUTPUT_BYTES = 128000;
10
10
  const DEFAULT_PYTHON_TIMEOUT_MS = 10000;
11
11
  const MAX_PYTHON_TIMEOUT_MS = 30000;
12
12
  const MAX_OUTPUT_CHARS = 50000;
13
+ const WINDOWS_POWERSHELL_UTF8_PREAMBLE = [
14
+ '[Console]::InputEncoding = [System.Text.UTF8Encoding]::new($false)',
15
+ '[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false)',
16
+ '$OutputEncoding = [Console]::OutputEncoding',
17
+ 'try { chcp.com 65001 > $null } catch {}',
18
+ ].join('; ');
13
19
 
14
20
  const TOOL_DEFINITIONS = [
15
21
  {
@@ -208,8 +214,9 @@ function execCommand(command, cwd, timeoutMs) {
208
214
  return new Promise((resolve, reject) => {
209
215
  const isWin = platform() === 'win32';
210
216
  const shellBin = isWin ? 'powershell.exe' : (process.env.SHELL || '/bin/sh');
217
+ const winCommand = isWin ? WINDOWS_POWERSHELL_UTF8_PREAMBLE + '; ' + command : command;
211
218
  const shellArgs = isWin
212
- ? ['-NoLogo', '-NoProfile', '-NonInteractive', '-Command', command]
219
+ ? ['-NoLogo', '-NoProfile', '-NonInteractive', '-Command', winCommand]
213
220
  : ['-c', command];
214
221
 
215
222
  const child = spawn(shellBin, shellArgs, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hupilot-shell-host",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Native Messaging host for Hupilot - local command execution and file access",
5
5
  "type": "module",
6
6
  "private": false,