@hmduc16031996/claude-mb-bridge 1.1.7 → 1.1.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/dist/index.js +7 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -59,10 +59,13 @@ program
|
|
|
59
59
|
});
|
|
60
60
|
async function handleUserPrompt(content, sessionId, cwd) {
|
|
61
61
|
console.log('⏳ Executing Claude Code with PTY...');
|
|
62
|
-
//
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
const
|
|
62
|
+
// Spawn claude directly (not via shell) so PTY works reliably across environments
|
|
63
|
+
const isWin = process.platform === 'win32';
|
|
64
|
+
const claudeExe = isWin ? 'cmd.exe' : 'claude';
|
|
65
|
+
const args = isWin
|
|
66
|
+
? ['/c', 'claude', '--print', content]
|
|
67
|
+
: ['--print', content];
|
|
68
|
+
const proc = pty.spawn(claudeExe, args, {
|
|
66
69
|
name: 'xterm-256color',
|
|
67
70
|
cols: 80,
|
|
68
71
|
rows: 24,
|
|
@@ -75,8 +78,6 @@ async function handleUserPrompt(content, sessionId, cwd) {
|
|
|
75
78
|
output += data;
|
|
76
79
|
process.stdout.write(data);
|
|
77
80
|
});
|
|
78
|
-
// Send the prompt through the PTY
|
|
79
|
-
proc.write(content + '\n');
|
|
80
81
|
return new Promise((resolve) => {
|
|
81
82
|
proc.onExit(async ({ exitCode }) => {
|
|
82
83
|
console.log(`\n✅ Claude Code finished with code ${exitCode}`);
|