dsh-remote 0.8.75 → 0.8.76
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/lib/exec-job.js +10 -3
- package/lib/openssh.js +6 -4
- package/lib/pool.js +12 -5
- package/package.json +1 -1
package/lib/exec-job.js
CHANGED
|
@@ -120,8 +120,11 @@ export function startExecJob(registry, { pool, command, label, owner, jobDeadlin
|
|
|
120
120
|
let sawStream = false
|
|
121
121
|
try {
|
|
122
122
|
res = await pool.exec(command, {
|
|
123
|
-
// 0
|
|
124
|
-
|
|
123
|
+
// Explicit 0 (not omission!) ⇒ no transport deadline: the job
|
|
124
|
+
// outlives the call. Merely OMITTING timeoutMs lets the transport
|
|
125
|
+
// substitute its config default (20s) and SIGTERM the promoted
|
|
126
|
+
// command — the issue #95 bug.
|
|
127
|
+
timeoutMs: jobDeadlineMs > 0 ? jobDeadlineMs : 0,
|
|
125
128
|
pty: !!pty,
|
|
126
129
|
env,
|
|
127
130
|
signal: ac.signal,
|
|
@@ -145,7 +148,11 @@ export function startExecJob(registry, { pool, command, label, owner, jobDeadlin
|
|
|
145
148
|
} catch { /* settled: ring closed */ }
|
|
146
149
|
}
|
|
147
150
|
if (res.signal === 'ABORTED' || cancelled) return { status: 'killed', detail: cancelled || 'cancelled' }
|
|
148
|
-
if (res.signal === 'TIMEOUT')
|
|
151
|
+
if (res.signal === 'TIMEOUT') {
|
|
152
|
+
// Print the deadline that actually applied; an unbounded job should
|
|
153
|
+
// never see TIMEOUT from us, so say so instead of printing undefinedms.
|
|
154
|
+
return { status: 'killed', detail: jobDeadlineMs > 0 ? `timed out after ${jobDeadlineMs}ms` : 'timed out (the job had no transport deadline — please report this)' }
|
|
155
|
+
}
|
|
149
156
|
const code = res.code
|
|
150
157
|
return {
|
|
151
158
|
status: code === 0 ? 'completed' : 'failed',
|
package/lib/openssh.js
CHANGED
|
@@ -530,7 +530,7 @@ export class SystemOpenSshPool {
|
|
|
530
530
|
async _runSsh(extraArgs, opts = {}) {
|
|
531
531
|
if (!this.config.host) throw new Error('no host configured')
|
|
532
532
|
const secret = await this._resolveSecret()
|
|
533
|
-
const timeoutMs = opts.timeoutMs || this.config.commandTimeoutMs
|
|
533
|
+
const timeoutMs = opts.timeoutMs === 0 ? 0 : (opts.timeoutMs || this.config.commandTimeoutMs)
|
|
534
534
|
const sshBinary = resolveSshBinary(this.config)
|
|
535
535
|
const args = [...baseSshArgs(this._argConfig(), { forSecret: !!secret }), ...extraArgs]
|
|
536
536
|
return new Promise((resolve) => {
|
|
@@ -562,14 +562,16 @@ export class SystemOpenSshPool {
|
|
|
562
562
|
})
|
|
563
563
|
}
|
|
564
564
|
const killHard = () => { try { setTimeout(() => { try { child.kill('SIGKILL') } catch {} }, 800).unref?.() } catch {} }
|
|
565
|
-
|
|
565
|
+
// No timer at all for an explicit no-deadline call (0) — see pool.js
|
|
566
|
+
// _execRaw; arming one would fire at once or kill a promoted job (issue #95).
|
|
567
|
+
const timer = timeoutMs > 0 ? setTimeout(() => {
|
|
566
568
|
if (settled) return
|
|
567
569
|
exitCode = -1
|
|
568
570
|
exitSignal = 'TIMEOUT'
|
|
569
571
|
try { child.kill() } catch {}
|
|
570
572
|
killHard()
|
|
571
573
|
finish()
|
|
572
|
-
}, timeoutMs)
|
|
574
|
+
}, timeoutMs) : null
|
|
573
575
|
if (opts.signal) {
|
|
574
576
|
if (opts.signal.aborted) {
|
|
575
577
|
try { child.kill() } catch {}
|
|
@@ -679,7 +681,7 @@ export class SystemOpenSshPool {
|
|
|
679
681
|
exec(command, timeoutMsOrOpts) {
|
|
680
682
|
const opts = timeoutMsOrOpts && typeof timeoutMsOrOpts === 'object' ? timeoutMsOrOpts : { timeoutMs: timeoutMsOrOpts }
|
|
681
683
|
return this.detect().then(() => {
|
|
682
|
-
const timeoutMs = opts.timeoutMs || this.config.commandTimeoutMs
|
|
684
|
+
const timeoutMs = opts.timeoutMs === 0 ? 0 : (opts.timeoutMs || this.config.commandTimeoutMs)
|
|
683
685
|
if (this.platform === 'windows' && this.gitBashPath) {
|
|
684
686
|
// Pipe the script to `bash -s` over stdin: no quoting round-trip, so
|
|
685
687
|
// quotes/backslashes/newlines survive verbatim (same as the native pool).
|
package/lib/pool.js
CHANGED
|
@@ -623,7 +623,9 @@ export class SshPool {
|
|
|
623
623
|
return this.detect().then(() => {
|
|
624
624
|
if (this.platform === 'windows' && this.gitBashPath) {
|
|
625
625
|
const script = String(command)
|
|
626
|
-
|
|
626
|
+
// Preserve an explicit 0 (no deadline, background jobs) through the
|
|
627
|
+
// wrapper: `||` would silently replace it with the default timeout.
|
|
628
|
+
return this._execRaw(`"${this.gitBashPath}" -s`, { ...opts, timeoutMs: opts.timeoutMs === 0 ? 0 : (opts.timeoutMs || this.config.commandTimeoutMs) }, (stream) => {
|
|
627
629
|
try { stream.end(script) } catch {}
|
|
628
630
|
})
|
|
629
631
|
}
|
|
@@ -632,9 +634,11 @@ export class SshPool {
|
|
|
632
634
|
}
|
|
633
635
|
|
|
634
636
|
/** Raw exec (no detection / no wrapper). Optional stdinWriter(stream) feeds
|
|
635
|
-
* the remote process stdin (used by the Git Bash `-s` mode).
|
|
637
|
+
* the remote process stdin (used by the Git Bash `-s` mode).
|
|
638
|
+
* `opts.timeoutMs === 0` is explicit: NO deadline (background jobs outlive
|
|
639
|
+
* their starting call); an absent value falls back to config.commandTimeoutMs. */
|
|
636
640
|
_execRaw(command, opts, stdinWriter) {
|
|
637
|
-
const timeoutMs = (opts && opts.timeoutMs) || this.config.commandTimeoutMs
|
|
641
|
+
const timeoutMs = (opts && opts.timeoutMs === 0) ? 0 : ((opts && opts.timeoutMs) || this.config.commandTimeoutMs)
|
|
638
642
|
const signal = opts && opts.signal
|
|
639
643
|
// Streaming tap for background jobs (issue #70): a promoted command's value
|
|
640
644
|
// is its LIVE output, which the job ring must receive as it arrives rather
|
|
@@ -689,7 +693,10 @@ export class SshPool {
|
|
|
689
693
|
stderr: truncate(stderr, this.config.maxOutputChars),
|
|
690
694
|
})
|
|
691
695
|
}
|
|
692
|
-
|
|
696
|
+
// No timer at all for an explicit no-deadline call (0): arming
|
|
697
|
+
// one with 0 would fire immediately, and with the config default
|
|
698
|
+
// it would SIGTERM a background job mid-promotion (issue #95).
|
|
699
|
+
const timer = timeoutMs > 0 ? setTimeout(() => {
|
|
693
700
|
if (settled) return
|
|
694
701
|
exitCode = -1
|
|
695
702
|
exitSignal = 'TIMEOUT'
|
|
@@ -704,7 +711,7 @@ export class SshPool {
|
|
|
704
711
|
}, 800)
|
|
705
712
|
if (typeof hardClose.unref === 'function') hardClose.unref()
|
|
706
713
|
settle()
|
|
707
|
-
}, timeoutMs)
|
|
714
|
+
}, timeoutMs) : null
|
|
708
715
|
if (signal) {
|
|
709
716
|
if (signal.aborted) {
|
|
710
717
|
try { if (typeof stream.signal === 'function') stream.signal('SIGTERM') } catch {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-remote",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.76",
|
|
4
4
|
"description": "Remote-work assistant for DeepSeek Harness: connect SSH (password/key/agent/keyboard-interactive, multi-hop ProxyJump), list hosts from ~/.ssh/config, pick a remote workspace, operate on it with 21 rw_* tools, conflict-aware mirror sync, an embedded PTY terminal, remote DSH web UI attach, port forwarding, host grouping, remote sandbox fencing, audit log, keychain passwords.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "flymysql <flyphp@outlook.com>",
|