@magpiecloud/mags 1.7.2 → 1.7.3
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/bin/mags.js +7 -2
- package/package.json +1 -1
package/bin/mags.js
CHANGED
|
@@ -1294,8 +1294,13 @@ async function execOnJob(nameOrId, command) {
|
|
|
1294
1294
|
sshArgs.push('-i', keyFile);
|
|
1295
1295
|
}
|
|
1296
1296
|
|
|
1297
|
-
// Wrap command to use chroot if overlay is mounted
|
|
1298
|
-
const
|
|
1297
|
+
// Wrap command to use chroot if overlay is mounted, with proper env
|
|
1298
|
+
const escaped = command.replace(/'/g, "'\\''");
|
|
1299
|
+
const wrappedCmd = `if [ -d /overlay/bin ]; then chroot /overlay /bin/sh -lc '${escaped}'; else /bin/sh -lc '${escaped}'; fi`;
|
|
1300
|
+
// Allocate TTY so interactive CLIs (e.g. claude) work
|
|
1301
|
+
if (process.stdin.isTTY) {
|
|
1302
|
+
sshArgs.push('-t');
|
|
1303
|
+
}
|
|
1299
1304
|
sshArgs.push(`root@${accessResp.ssh_host}`, wrappedCmd);
|
|
1300
1305
|
|
|
1301
1306
|
const ssh = spawn('ssh', sshArgs, { stdio: 'inherit' });
|