mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
feat(sandbox): add KVM-backed agent sandboxing via microsandbox
This commit is contained in:
1 parent
1d477bdee4
commit
aa3fb48a62
80 files changed
+17304
-204
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { executeCommand } from '../../src/utils/process'
|
||||
|
||||
describe('executeCommand signal handling', () => {
|
||||
it('reports a signal-terminated child as a non-zero exit code when exit codes are ignored', async () => {
|
||||
const result = await executeCommand(['sh', '-c', 'kill -KILL $$'], {
|
||||
ignoreExitCode: true,
|
||||
silent: true,
|
||||
})
|
||||
const structured = typeof result === 'string' ? { exitCode: 0, stdout: result, stderr: '' } : result
|
||||
|
||||
expect(structured.exitCode).not.toBe(0)
|
||||
expect(structured.stderr).toContain('Command terminated by signal SIGKILL')
|
||||
})
|
||||
|
||||
it('rejects a signal-terminated child when exit codes are enforced', async () => {
|
||||
await expect(executeCommand(['sh', '-c', 'kill -KILL $$'], { silent: true })).rejects.toThrow(
|
||||
'Command failed with signal SIGKILL',
|
||||
)
|
||||
})
|
||||
|
||||
it('resolves a zero exit code as success when exit codes are ignored', async () => {
|
||||
const result = await executeCommand(['sh', '-c', 'true'], { ignoreExitCode: true, silent: true })
|
||||
|
||||
expect(result).toEqual({ exitCode: 0, stdout: '', stderr: '' })
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user