Skip to content

Commit a74624a

Browse files
DilumAluthgestaticfloat
authored andcommitted
For the warn_priviledged function, use maxlog=1 instead of using a global variable
1 parent 51bf7f4 commit a74624a

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/Sandbox.jl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,9 @@ function preferred_executor(;verbose::Bool = false)
103103
end
104104

105105
# Helper function for warning about privileged execution trying to invoke `sudo`
106-
prompted_userns_privileged = false
107106
function warn_priviledged(::PrivilegedUserNamespacesExecutor)
108-
global prompted_userns_privileged
109-
if !prompted_userns_privileged
110-
@info("Running privileged container via `sudo`, may ask for your password:")
111-
prompted_userns_privileged = true
112-
end
107+
@info("Running privileged container via `sudo`, may ask for your password:", maxlog=1)
108+
return nothing
113109
end
114110
warn_priviledged(::SandboxExecutor) = nothing
115111

test/UserNamespaces.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ end
4444
if success(`sudo -k -n true`)
4545
if executor_available(PrivilegedUserNamespacesExecutor)
4646
@testset "PrivilegedUserNamespacesExecutor" begin
47-
@test_logs (:info, "Testing Privileged User Namespaces Executor (read-only, read-write)") begin
47+
@test_logs (:info, "Testing Privileged User Namespaces Executor (read-only, read-write)") match_mode=:any begin
4848
with_executor(PrivilegedUserNamespacesExecutor) do exe
4949
@test probe_executor(exe; test_read_only_map=true, test_read_write_map=true, verbose=true)
5050
end

0 commit comments

Comments
 (0)