opencode-landstrip 0.16.8 → 0.16.9
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/index.ts +10 -5
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -665,12 +665,17 @@ function buildWrappedCommand(
|
|
|
665
665
|
if (trapPort === null) return plain;
|
|
666
666
|
|
|
667
667
|
// Connect fd 3 to the TUI's query-response socket BEFORE landstrip applies the
|
|
668
|
-
// sandbox, so a denied
|
|
669
|
-
//
|
|
670
|
-
//
|
|
671
|
-
//
|
|
668
|
+
// sandbox, so a denied filesystem access can be approved live instead of
|
|
669
|
+
// forcing a re-run.
|
|
670
|
+
//
|
|
671
|
+
// /dev/tcp is a bash/ksh built-in — it does not work in zsh, dash, or fish.
|
|
672
|
+
// We try the native redirect first (fast path when the host shell supports it)
|
|
673
|
+
// and fall back to an explicit bash invocation that always speaks /dev/tcp.
|
|
674
|
+
// If both fail (no bash, dead port, set -e in the outer shell) landstrip runs
|
|
675
|
+
// without --trap-fd so the toast-notify path still works.
|
|
672
676
|
const trapped = [landstripBinaryPath(), '--trap-fd', '3', ...baseArgs].map(shellQuote).join(' ');
|
|
673
|
-
|
|
677
|
+
const bashTrap = `bash -c ${shellQuote(`exec 3<>/dev/tcp/127.0.0.1/${trapPort} && exec "$@"`)} bash ${trapped}`;
|
|
678
|
+
return `{ exec 3<>/dev/tcp/127.0.0.1/${trapPort} ; } 2>/dev/null && ${trapped} || ${bashTrap} 2>/dev/null || ${plain}`;
|
|
674
679
|
}
|
|
675
680
|
|
|
676
681
|
function isGeneratedWrappedCommand(command: string): boolean {
|