diff --git a/src/ClawdDotNet.Core/Sandbox/BwrapSandbox.cs b/src/ClawdDotNet.Core/Sandbox/BwrapSandbox.cs index 3f5898f..b695344 100644 --- a/src/ClawdDotNet.Core/Sandbox/BwrapSandbox.cs +++ b/src/ClawdDotNet.Core/Sandbox/BwrapSandbox.cs @@ -186,8 +186,9 @@ public sealed class BwrapSandbox : ISandboxRunner args.AddRange(["--seccomp", "3", "--"]); - // Inner: the process limit, set inside the sandbox's own user namespace. - args.AddRange([Shell, "-c", """ulimit -u "$1" || exit 126; shift; exec "$@" """, "sh", + // Inner: the process limit, set inside the sandbox's own user namespace. bash calls it + // -u, dash (Debian's and Ubuntu's sh) -p; if neither takes, nothing runs. + args.AddRange([Shell, "-c", """ulimit -u "$1" 2>/dev/null || ulimit -p "$1" || exit 126; shift; exec "$@" """, "sh", limits.MaxProcesses.ToString(CultureInfo.InvariantCulture), request.Executable]); args.AddRange(request.Arguments); return args;