@wwkit/shared 1.0.25 → 1.0.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wwkit/shared",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "author": "bluesliu <langcai163@163.com>",
5
5
  "description": "Shared utilities for @wwkit packages — config loader, platform detection",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { createConfigLoader, getXdgConfigDir, deepMerge, resolveEnvVars, resolvePkgVars } from './config-loader.js'
2
2
  export { Shell } from './shell.js'
3
3
  export { parseProxy, openTunnel, fetchText, downloadToFile } from './http.js'
4
- export { parseFlags, DEFAULT_BOOLEAN_FLAGS } from './args.js'
4
+ export { parseFlags, DEFAULT_BOOLEAN_FLAGS } from './args.js'
5
+ export { default as JSON5 } from 'json5'
package/src/shell.js CHANGED
@@ -88,6 +88,24 @@ export class Shell {
88
88
  return needsBash ? this.resolveBash() : true
89
89
  }
90
90
 
91
+ /**
92
+ * 返回 execSync / spawnSync 在继承终端输出时的 stdio 选项
93
+ *
94
+ * Windows + bash 下 stdio: 'inherit' 会使 bash 继承终端 stdin,
95
+ * 命令完成后 bash 仍等待 stdin EOF 不退出,导致 execSync/spawnSync 永久挂起。
96
+ * 改用 ['ignore', 'inherit', 'inherit']:stdin → NUL,bash 立即收到 EOF 退出;
97
+ * stdout/stderr 仍继承终端,输出可见。
98
+ *
99
+ * @param {boolean} needsBash - 是否使用 bash 作为 shell
100
+ * @returns {'inherit'|string[]} stdio 选项
101
+ */
102
+ stdioForExec(needsBash) {
103
+ if (needsBash && this.isWindows) {
104
+ return ['ignore', 'inherit', 'inherit']
105
+ }
106
+ return 'inherit'
107
+ }
108
+
91
109
  /**
92
110
  * 检测当前 shell 的 profile 文件路径
93
111
  *