@wwkit/shared 1.0.24 → 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 +1 -1
- package/src/index.js +2 -1
- package/src/shell.js +18 -0
package/package.json
CHANGED
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
|
*
|