Skip to content

Commit bb02a52

Browse files
committed
chore: try fix rpc
1 parent 8c8097e commit bb02a52

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

packages/devtools/client/composables/rpc.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export const rpc = createBirpc<ServerFunctions>(clientFunctions, {
3535
onError(error, name) {
3636
console.error(`[nuxt-devtools] RPC error on executing "${name}":`, error)
3737
},
38+
timeout: 120_000,
3839
})
3940

4041
async function connectWS() {

packages/devtools/src/server-rpc/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export function setupRPC(nuxt: Nuxt, options: ModuleOptions) {
3838
onError(error, name) {
3939
console.error(`[nuxt-devtools] RPC error on executing "${name}":`, error)
4040
},
41+
timeout: 120_000,
4142
},
4243
)
4344

packages/devtools/src/server-rpc/npm.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ export function setupNpmRPC({ nuxt }: NuxtDevtoolsServerContext) {
8888
})
8989

9090
const execa = process.getProcess()
91-
await execa
91+
const result = await execa
9292

9393
await Promise.resolve()
9494

95-
const code = execa.exitCode || 0
95+
const code = result.exitCode
9696
if (code !== 0) {
97-
console.error(String(execa.stderr))
97+
console.error(result.stderr)
9898
throw new Error(`Failed to install module, process exited with ${code}`)
9999
}
100100

@@ -140,11 +140,16 @@ export function setupNpmRPC({ nuxt }: NuxtDevtoolsServerContext) {
140140
icon: 'carbon:intent-request-uninstall',
141141
restartable: false,
142142
})
143+
const execa = process.getProcess()
144+
const result = await execa
143145

144-
await process.getProcess()
146+
await Promise.resolve()
145147

146-
if (process.getProcess().exitCode !== 0)
147-
throw new Error('Failed to uninstall module')
148+
const code = result.exitCode
149+
if (code !== 0) {
150+
console.error(result.stderr)
151+
throw new Error(`Failed to uninstall module', process exited with ${code}`)
152+
}
148153

149154
await fs.writeFile(filepath, generated, 'utf-8')
150155
}

0 commit comments

Comments
 (0)