add memory limit
This commit is contained in:
27
runner/limiter_other.go
Normal file
27
runner/limiter_other.go
Normal file
@@ -0,0 +1,27 @@
|
||||
//go:build !linux && !windows
|
||||
|
||||
package runner
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
type noopLimiter struct {
|
||||
memLimit int64
|
||||
}
|
||||
|
||||
func newLimiter(memLimit int64) limiter {
|
||||
return &noopLimiter{memLimit: memLimit}
|
||||
}
|
||||
|
||||
func (l *noopLimiter) prepare(cmd *exec.Cmd) error {
|
||||
if l.memLimit > 0 {
|
||||
return fmt.Errorf("memory_limit is not supported on this platform (only linux/windows)")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *noopLimiter) afterStart(cmd *exec.Cmd) error { return nil }
|
||||
func (l *noopLimiter) collect() limitStats { return limitStats{} }
|
||||
func (l *noopLimiter) cleanup() {}
|
||||
Reference in New Issue
Block a user