@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.
Files changed (2) hide show
  1. package/bin/mags.js +7 -2
  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 wrappedCmd = `if [ -d /overlay/bin ]; then chroot /overlay /bin/sh -c '${command.replace(/'/g, "'\\''")}'; else /bin/sh -c '${command.replace(/'/g, "'\\''")}'; fi`;
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' });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpiecloud/mags",
3
- "version": "1.7.2",
3
+ "version": "1.7.3",
4
4
  "description": "Mags CLI - Execute scripts on Magpie's instant VM infrastructure",
5
5
  "main": "index.js",
6
6
  "bin": {