Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
kube-bench
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
aquasecurity
kube-bench
Commits
b1a76360
Commit
b1a76360
authored
7 years ago
by
Abubakr-Sadik Nii Nai Davis
Browse files
Options
Downloads
Patches
Plain Diff
Do not clutter the output with error messages from commands in the audit pipeline.
parent
6ee9bedf
No related branches found
Branches containing commit
Tags
38.18.15
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check/check.go
+13
-13
13 additions, 13 deletions
check/check.go
with
13 additions
and
13 deletions
check/check.go
+
13
−
13
View file @
b1a76360
...
@@ -63,7 +63,7 @@ type Check struct {
...
@@ -63,7 +63,7 @@ type Check struct {
// Run executes the audit commands specified in a check and outputs
// Run executes the audit commands specified in a check and outputs
// the results.
// the results.
func
(
c
*
Check
)
Run
()
{
func
(
c
*
Check
)
Run
()
{
var
out
bytes
.
Buffer
var
out
,
serr
bytes
.
Buffer
// Check if command exists or exit with WARN.
// Check if command exists or exit with WARN.
for
_
,
cmd
:=
range
c
.
Commands
{
for
_
,
cmd
:=
range
c
.
Commands
{
...
@@ -87,7 +87,8 @@ func (c *Check) Run() {
...
@@ -87,7 +87,8 @@ func (c *Check) Run() {
// cmd0 err should terminate chain
// cmd0 err should terminate chain
cs
:=
c
.
Commands
cs
:=
c
.
Commands
cs
[
0
]
.
Stderr
=
os
.
Stderr
// Initialize command pipeline
cs
[
0
]
.
Stderr
=
&
serr
cs
[
n
-
1
]
.
Stdout
=
&
out
cs
[
n
-
1
]
.
Stdout
=
&
out
i
:=
1
i
:=
1
...
@@ -99,27 +100,26 @@ func (c *Check) Run() {
...
@@ -99,27 +100,26 @@ func (c *Check) Run() {
os
.
Exit
(
1
)
os
.
Exit
(
1
)
}
}
cs
[
i
]
.
Stderr
=
os
.
Std
err
cs
[
i
]
.
Stderr
=
&
s
err
i
++
i
++
}
}
// Start command pipeline
i
=
0
i
=
0
for
i
<
n
{
for
i
<
n
{
err
:=
cs
[
i
]
.
Start
()
cs
[
i
]
.
Start
()
if
err
!=
nil
{
i
++
fmt
.
Fprintf
(
os
.
Stderr
,
"%s: %s
\n
"
,
cs
[
i
]
.
Args
,
err
)
}
os
.
Exit
(
1
)
}
errw
:=
cs
[
i
]
.
Wait
()
// Complete command pipeline
if
err
!=
nil
{
i
=
0
fmt
.
Fprintf
(
os
.
Stderr
,
"%s: %s
\n
"
,
cs
[
i
]
.
Args
,
errw
)
for
i
<
n
{
os
.
Exit
(
1
)
cs
[
i
]
.
Wait
()
}
if
i
<
n
-
1
{
if
i
<
n
-
1
{
cs
[
i
]
.
Stdout
.
(
io
.
Closer
)
.
Close
()
cs
[
i
]
.
Stdout
.
(
io
.
Closer
)
.
Close
()
}
}
i
++
i
++
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment