Skip to content

Commit f771c29

Browse files
authored
chore: improve thv and secrets logs (#892)
* chore: improve thv and secrets logs * leftover * chore: catpure only errors * test: upgrade stdio config
1 parent 0707133 commit f771c29

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

main/src/tests/toolhive-manager.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ describe('toolhive-manager', () => {
153153
expect.stringMatching(/--port=\d+/),
154154
]),
155155
{
156-
stdio: 'ignore',
156+
stdio: ['ignore', 'ignore', 'pipe'],
157157
detached: false,
158158
}
159159
)
@@ -276,7 +276,7 @@ describe('toolhive-manager', () => {
276276
expect.stringMatching(/--port=\d+/),
277277
]),
278278
{
279-
stdio: 'ignore',
279+
stdio: ['ignore', 'ignore', 'pipe'],
280280
detached: false,
281281
}
282282
)

main/src/toolhive-manager.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export async function startToolhive(tray?: Tray): Promise<void> {
128128
`--port=${toolhivePort}`,
129129
],
130130
{
131-
stdio: 'ignore',
131+
stdio: ['ignore', 'ignore', 'pipe'],
132132
detached: false,
133133
}
134134
)
@@ -139,6 +139,17 @@ export async function startToolhive(tray?: Tray): Promise<void> {
139139
updateTrayStatus(tray, !!toolhiveProcess)
140140
}
141141

142+
// Capture and log stderr
143+
if (toolhiveProcess.stderr) {
144+
log.info(`[ToolHive] Capturing stderr enabled`)
145+
toolhiveProcess.stderr.on('data', (data) => {
146+
const output = data.toString().trim()
147+
if (output) {
148+
log.error(`[ToolHive stderr] ${output}`)
149+
}
150+
})
151+
}
152+
142153
toolhiveProcess.on('error', (error) => {
143154
log.error('Failed to start ToolHive: ', error)
144155
Sentry.captureMessage(

renderer/src/routes/__root.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ async function setupSecretProvider(queryClient: QueryClient) {
3434
await createEncryptedProvider()
3535
}
3636
})
37-
.catch(createEncryptedProvider)
37+
.catch((err) => {
38+
log.info(
39+
'Error setting up secret provider, creating encrypted provider',
40+
JSON.stringify(err)
41+
)
42+
return createEncryptedProvider()
43+
})
3844
}
3945

4046
function RootComponent() {

0 commit comments

Comments
 (0)