Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nirvana api print fatal error invalid character '\x1b' looking for beginning of value #335

Open
narrowizard opened this issue Jun 11, 2020 · 4 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@narrowizard
Copy link
Contributor

Is this a BUG REPORT or FEATURE REQUEST?:

Uncomment only one, leave it on its own line:

/kind bug

/kind feature

What happened:
nirvana print a fatal error when running nirvana api.

$ nirvana api --output="./api"
INFO  0611-14:39:33.220+08 api.go:87 | No packages are specified, defaults to pkg/apis
FATAL 0611-14:40:03.467+08 api.go:61 | invalid character '\x1b' looking for beginning of value

What you expected to happen:
the error is unexpected.
How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:
after some searching, i find the error is reported by json.Unmarshal.
nirvana api generated a nirvana-generated*** file and run it to get a json formated api-definition string, then output the string to standard output(cmd). and read the string from standard output(cmd), decode it to &api.Definitions{}.
the error occur when my project output something to cmd.

std.out

nirvana-generated****

cmd := exec.Command("go", "run", path)
cmd.Stderr = os.Stderr
buf := bytes.NewBuffer(nil)
cmd.Stdout = buf
if err := cmd.Run(); err != nil {
return nil, err
}
definitions := &api.Definitions{}
if err := json.NewDecoder(buf).Decode(definitions); err != nil {
return nil, err
}
return definitions, nil

@caicloud-bot caicloud-bot added the kind/bug Categorizes issue or PR as related to a bug. label Jun 11, 2020
@lsytj0413
Copy link
Contributor

/cc @iawia002

@iawia002
Copy link

So you are logging something in the init function of descriptors or modifiers file?

@narrowizard
Copy link
Contributor Author

not exactly, init function in other package which is imported by descriptors. @iawia002

@iawia002
Copy link

Got it, I'll fix this when I'm free (may take days)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

4 participants