@crouton-kit/humanloop 0.3.23 → 0.3.24
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/dist/tui/app.js +8 -1
- package/package.json +1 -1
package/dist/tui/app.js
CHANGED
|
@@ -402,13 +402,20 @@ export async function resolveInteractionDir(dir, deck, opts = {}) {
|
|
|
402
402
|
try {
|
|
403
403
|
restoreTerminal();
|
|
404
404
|
writeFileSync(tmpFile, buffer);
|
|
405
|
-
|
|
405
|
+
// $EDITOR is conventionally a shell fragment, not a bare binary —
|
|
406
|
+
// "code --wait", "emacsclient -t" — so run it through the shell (as
|
|
407
|
+
// git does) with the filename passed safely as a positional arg.
|
|
408
|
+
const result = spawnSync('/bin/sh', ['-c', `${editor} "$1"`, 'sh', tmpFile], { stdio: 'inherit' });
|
|
406
409
|
if (result.error) {
|
|
407
410
|
errorMessage = `$EDITOR ("${editor}") failed to launch: ${result.error.message}`;
|
|
408
411
|
}
|
|
409
412
|
else if (result.signal !== null) {
|
|
410
413
|
errorMessage = `$EDITOR ("${editor}") was killed by signal ${result.signal}`;
|
|
411
414
|
}
|
|
415
|
+
else if (result.status === 127 || result.status === 126) {
|
|
416
|
+
// Shell couldn't exec the editor: 127 = not found, 126 = not executable.
|
|
417
|
+
errorMessage = `$EDITOR ("${editor}") failed to launch (shell exit ${result.status})`;
|
|
418
|
+
}
|
|
412
419
|
else if (result.status !== 0) {
|
|
413
420
|
errorMessage = `$EDITOR ("${editor}") exited with status ${result.status}`;
|
|
414
421
|
}
|