@leiyi-works/dsh-cloud-sync 0.1.9 → 0.1.10

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.
Files changed (2) hide show
  1. package/exec.js +6 -2
  2. package/package.json +1 -1
package/exec.js CHANGED
@@ -89,6 +89,9 @@ class ManagedChild extends EventEmitter {
89
89
  /** 平台 VM 桥只接管这些 shell 作为 argv[0];其它程序需要包成 `shell -c 'exec …'`。 */
90
90
  const SHELLS = new Set(['bash', 'sh', 'ash', 'dash', 'zsh', 'ksh'])
91
91
 
92
+ /** 是否需要 shell 包壳:Windows 上 provider 就是本地实现、没有 bash,不能包。 */
93
+ const WANTS_SHELL_WRAP = process.platform !== 'win32'
94
+
92
95
  function baseName(value) {
93
96
  return String(value).split(/[\\/]/).pop()
94
97
  }
@@ -123,9 +126,10 @@ export function spawnManaged(argv, options = {}) {
123
126
  if (provider !== null) {
124
127
  // 手机侧(DSHM)的 subprocess 实现只把 shell 命令转进 guest;
125
128
  // 直接 spawn('ssh') 会被 fail-open 回原生 spawn → ENOENT。
126
- // 所以非 shell 的 argv 一律包成 `bash -c 'exec …'`,让它走 guest。
129
+ // 所以非 shell 的 argv 包成 `bash -c 'exec …'`,让它走 guest。
130
+ // 注意:Windows 上 provider 就是本地实现、且通常没有 bash,不能包装。
127
131
  const head = baseName(argv[0])
128
- if (options.noWrap !== true && !SHELLS.has(head)) {
132
+ if (WANTS_SHELL_WRAP && options.noWrap !== true && !SHELLS.has(head)) {
129
133
  const shell = process.env.DSH_CLOUD_SYNC_SHELL || 'bash'
130
134
  const line = `exec ${argv.map(quoteArg).join(' ')}`
131
135
  return spawnViaProvider([shell, '-c', line], options)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leiyi-works/dsh-cloud-sync",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "title": "云端同步",
6
6
  "description": "云端同步:subprocess 通道自动用 shell 包壳(HarmonyOS/DSHM 可跑)、设备模式默认值、dropbear 兼容、永久错误停止重试、传输诊断。",