@geekbeer/minion 2.16.2 → 2.16.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/package.json +1 -1
- package/routes/auth.js +25 -3
package/package.json
CHANGED
package/routes/auth.js
CHANGED
|
@@ -112,12 +112,15 @@ function startClaudeAuth() {
|
|
|
112
112
|
|
|
113
113
|
try {
|
|
114
114
|
// Start claude auth login in a new tmux session
|
|
115
|
-
//
|
|
115
|
+
// Use inline env vars in the shell command for compatibility with all tmux versions
|
|
116
|
+
// (tmux -e flag requires tmux 3.2+)
|
|
116
117
|
// CLAUDECODE='' prevents the nesting check
|
|
117
118
|
execSync(
|
|
118
|
-
`tmux new-session -d -s ${TMUX_SESSION} -x 500 -y 40
|
|
119
|
+
`tmux new-session -d -s ${TMUX_SESSION} -x 500 -y 40 'export HOME="${config.HOME_DIR}" PATH="${extendedPath}"; CLAUDECODE="" claude auth login'`,
|
|
119
120
|
{ timeout: 5000 }
|
|
120
121
|
)
|
|
122
|
+
// Keep pane alive after command exits so we can capture error output
|
|
123
|
+
execSync(`tmux set-option -t ${TMUX_SESSION} remain-on-exit on`)
|
|
121
124
|
} catch (err) {
|
|
122
125
|
reject(new Error(`Failed to create tmux session: ${err.message}`))
|
|
123
126
|
return
|
|
@@ -136,7 +139,16 @@ function startClaudeAuth() {
|
|
|
136
139
|
const pollInterval = setInterval(() => {
|
|
137
140
|
if (resolved) return
|
|
138
141
|
|
|
139
|
-
if (
|
|
142
|
+
// Check if the process inside the pane has exited (remain-on-exit keeps pane alive)
|
|
143
|
+
let paneDead = false
|
|
144
|
+
try {
|
|
145
|
+
const deadFlag = execSync(
|
|
146
|
+
`tmux list-panes -t ${TMUX_SESSION} -F '#{pane_dead}'`,
|
|
147
|
+
{ encoding: 'utf-8', timeout: 3000 }
|
|
148
|
+
).trim()
|
|
149
|
+
paneDead = deadFlag === '1'
|
|
150
|
+
} catch {
|
|
151
|
+
// Session itself is gone
|
|
140
152
|
resolved = true
|
|
141
153
|
clearInterval(pollInterval)
|
|
142
154
|
reject(new Error('Auth session ended unexpectedly'))
|
|
@@ -146,6 +158,16 @@ function startClaudeAuth() {
|
|
|
146
158
|
const content = captureTmuxPane()
|
|
147
159
|
const clean = stripAnsi(content)
|
|
148
160
|
|
|
161
|
+
// If process exited, capture output for diagnostics and report error
|
|
162
|
+
if (paneDead) {
|
|
163
|
+
resolved = true
|
|
164
|
+
clearInterval(pollInterval)
|
|
165
|
+
console.error(`[Auth] Process exited. Pane output:\n${clean.slice(0, 1000)}`)
|
|
166
|
+
try { execSync(`tmux kill-session -t ${TMUX_SESSION} 2>/dev/null`) } catch {}
|
|
167
|
+
reject(new Error(`Auth process exited. Output: ${clean.slice(0, 300) || '(none)'}`))
|
|
168
|
+
return
|
|
169
|
+
}
|
|
170
|
+
|
|
149
171
|
// Check for URL at any stage
|
|
150
172
|
const url = extractUrlFromPane(content)
|
|
151
173
|
if (url) {
|