Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/commands/runtime/sandbox/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ class SandboxRun extends RuntimeBaseCommand {
await this._handleExec(sandbox, trimmed)
}
} catch (err) {
this.log(`exec error: ${err.message || err}`)
const msg = err.message || String(err)
const hint = msg.includes('exceeded timeout') ? ' (use .detached for long-running commands)' : ''
this.log(`exec error: ${msg}${hint}`)
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions test/commands/runtime/sandbox/run.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,16 @@ describe('run', () => {
expect(stdout.output).toMatch('exec error: plain string error')
})

test('REPL: timeout errors include a hint to use .detached', async () => {
readline.createInterface.mockReturnValue(makeRl(['sleep 35', 'exit']))
sandbox.exec.mockRejectedValueOnce(new Error("Command 'sleep 35' exceeded timeout of 30000ms"))

command.argv = []
await command.run()

expect(stdout.output).toMatch('exec error: Command \'sleep 35\' exceeded timeout of 30000ms (use .detached for long-running commands)')
})

test('REPL: detached command starts in background and streams output', async () => {
const rl = makeRl(['.detached npm run dev', 'exit'])
readline.createInterface.mockReturnValue(rl)
Expand Down
Loading