@wyxos/zephyr 0.1.6 → 0.1.7
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.mjs +14 -3
package/package.json
CHANGED
package/src/index.mjs
CHANGED
|
@@ -778,11 +778,22 @@ async function runRemoteTasks(config, options = {}) {
|
|
|
778
778
|
'if [ -f "$HOME/.zshrc" ]; then . "$HOME/.zshrc"; fi'
|
|
779
779
|
].join('; ')
|
|
780
780
|
|
|
781
|
+
const escapeForDoubleQuotes = (value) => value.replace(/(["\\$`])/g, '\\$1')
|
|
782
|
+
|
|
781
783
|
const executeRemote = async (label, command, options = {}) => {
|
|
782
784
|
const { cwd = remoteCwd, allowFailure = false, printStdout = true, bootstrapEnv = true } = options
|
|
783
785
|
logProcessing(`\n→ ${label}`)
|
|
784
|
-
|
|
785
|
-
|
|
786
|
+
|
|
787
|
+
let wrappedCommand = command
|
|
788
|
+
let execOptions = { cwd }
|
|
789
|
+
|
|
790
|
+
if (bootstrapEnv) {
|
|
791
|
+
const cwdForShell = escapeForDoubleQuotes(cwd)
|
|
792
|
+
wrappedCommand = `${profileBootstrap}; cd "${cwdForShell}" && ${command}`
|
|
793
|
+
execOptions = {}
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
const result = await ssh.execCommand(wrappedCommand, execOptions)
|
|
786
797
|
|
|
787
798
|
if (printStdout && result.stdout && result.stdout.trim()) {
|
|
788
799
|
console.log(result.stdout.trim())
|
|
@@ -798,7 +809,7 @@ async function runRemoteTasks(config, options = {}) {
|
|
|
798
809
|
|
|
799
810
|
if (result.code !== 0 && !allowFailure) {
|
|
800
811
|
const stderr = result.stderr?.trim() ?? ''
|
|
801
|
-
|
|
812
|
+
if (/command not found/.test(stderr) || /is not recognized/.test(stderr)) {
|
|
802
813
|
throw new Error(
|
|
803
814
|
`Command failed: ${command}. Ensure the remote environment loads required tools for non-interactive shells (e.g. export PATH in profile scripts).`
|
|
804
815
|
)
|