Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-cli
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Operations
Operations
Metrics
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-cli
Commits
b279d4b3
Commit
b279d4b3
authored
May 06, 2024
by
Cristian Maglie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed 'feedback' package initialization order
parent
9585728e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
23 deletions
+20
-23
internal/cli/cli.go
internal/cli/cli.go
+18
-21
internal/integrationtest/board/board_test.go
internal/integrationtest/board/board_test.go
+2
-2
No files found.
internal/cli/cli.go
View file @
b279d4b3
...
...
@@ -203,19 +203,22 @@ func toLogLevel(s string) (t logrus.Level, found bool) {
}
func
preRun
(
verbose
bool
,
outputFormat
string
,
logLevel
,
logFile
,
logFormat
string
,
noColor
bool
,
settings
*
rpc
.
Configuration
)
{
// initialize inventory
err
:=
inventory
.
Init
(
settings
.
GetDirectories
()
.
GetData
())
if
err
!=
nil
{
feedback
.
Fatal
(
fmt
.
Sprintf
(
"Error: %v"
,
err
),
feedback
.
ErrInitializingInventory
)
}
// https://no-color.org/
color
.
NoColor
=
noColor
||
os
.
Getenv
(
"NO_COLOR"
)
!=
""
//
// Prepare the Feedback system
//
// Set default feedback output to colorable
color
.
NoColor
=
noColor
||
os
.
Getenv
(
"NO_COLOR"
)
!=
""
// https://no-color.org/
feedback
.
SetOut
(
colorable
.
NewColorableStdout
())
feedback
.
SetErr
(
colorable
.
NewColorableStderr
())
// use the output format to configure the Feedback
format
,
ok
:=
feedback
.
ParseOutputFormat
(
outputFormat
)
if
!
ok
{
feedback
.
Fatal
(
tr
(
"Invalid output format: %s"
,
outputFormat
),
feedback
.
ErrBadArgument
)
}
feedback
.
SetFormat
(
format
)
//
// Prepare logging
//
...
...
@@ -260,20 +263,14 @@ func preRun(verbose bool, outputFormat string, logLevel, logFile, logFormat stri
logrus
.
SetLevel
(
logrusLevel
)
}
//
// Prepare the Feedback system
//
// use the output format to configure the Feedback
format
,
ok
:=
feedback
.
ParseOutputFormat
(
outputFormat
)
if
!
ok
{
feedback
.
Fatal
(
tr
(
"Invalid output format: %s"
,
outputFormat
),
feedback
.
ErrBadArgument
)
}
feedback
.
SetFormat
(
format
)
// Print some status info and check command is consistent
logrus
.
Info
(
versioninfo
.
VersionInfo
.
Application
+
" version "
+
versioninfo
.
VersionInfo
.
VersionString
)
//
//
Print some status info and check command is consistent
//
Initialize inventory
//
logrus
.
Info
(
versioninfo
.
VersionInfo
.
Application
+
" version "
+
versioninfo
.
VersionInfo
.
VersionString
)
err
:=
inventory
.
Init
(
settings
.
GetDirectories
()
.
GetData
())
if
err
!=
nil
{
feedback
.
Fatal
(
fmt
.
Sprintf
(
"Error: %v"
,
err
),
feedback
.
ErrInitializingInventory
)
}
}
internal/integrationtest/board/board_test.go
View file @
b279d4b3
...
...
@@ -651,7 +651,7 @@ func TestCLIStartupWithCorruptedInventory(t *testing.T) {
require
.
NoError
(
t
,
f
.
Close
())
// the CLI should not be able to load inventory and report it to the logs
_
,
stderr
,
err
:=
cli
.
Run
(
"core"
,
"update-index"
,
"-v"
)
stdout
,
_
,
err
:=
cli
.
Run
(
"core"
,
"update-index"
,
"-v"
)
require
.
NoError
(
t
,
err
)
require
.
Contains
(
t
,
string
(
std
err
),
"Error loading inventory store"
)
require
.
Contains
(
t
,
string
(
std
out
),
"Error loading inventory store"
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment