@zhangfengshun/dsh-remote-ssh 2.1.1 → 2.1.2

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/lib/index.js +5 -1
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -279,6 +279,9 @@ function sshArgv(p, remoteCmd, tty) {
279
279
  opts.push("-o", "ConnectTimeout=15");
280
280
  opts.push("-o", "ServerAliveInterval=30");
281
281
  opts.push("-o", "ServerAliveCountMax=3");
282
+ // 插件内部连接(文件读写/工具/同步)不需要端口转发;
283
+ // 清除 ssh config 里的 RemoteForward/LocalForward,避免端口被占时连接直接失败。
284
+ opts.push("-o", "ClearAllForwardings=yes");
282
285
  if (p.proxyJump) opts.push("-o", "ProxyJump=" + String(p.proxyJump));
283
286
  if (p.authMethod === "key" && p.keyPath) opts.push("-i", p.keyPath);
284
287
  const target = String(p.user || "") + "@" + String(p.host || "");
@@ -1348,7 +1351,8 @@ function apply(ctx, config) {
1348
1351
  " const j = JSON.parse(fs.readFileSync(info, 'utf8'));",
1349
1352
  " if (j.keyPath && j.keyPath !== '' && j.host && j.user) {",
1350
1353
  " const port = j.port || 22;",
1351
- " const args = ['-tt', '-o', 'StrictHostKeyChecking=no', '-p', String(port), '-i', j.keyPath, j.user + '@' + j.host];",
1354
+ " // ExitOnForwardFailure=no:ssh config 里的 RemoteForward 端口被占时终端仍能打开",
1355
+ " const args = ['-tt', '-o', 'StrictHostKeyChecking=no', '-o', 'ExitOnForwardFailure=no', '-p', String(port), '-i', j.keyPath, j.user + '@' + j.host];",
1352
1356
  " if (j.proxyJump) { args.splice(2, 0, '-J', j.proxyJump); }",
1353
1357
  " const ssh = spawn('ssh', args, { stdio: 'inherit' });",
1354
1358
  " ssh.on('exit', function(c) { process.exit(c == null ? 0 : c); });",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhangfengshun/dsh-remote-ssh",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "DSH web plugin: VSCode Remote-SSH-like remote development (SSH to supercomputers/servers, remote workspace, file explorer, integrated terminal), integrated with dsh-better-sidebar and DSH settings.",
5
5
  "keywords": [
6
6
  "dsh",