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

after dump, stderr output disappear #2403

Closed
5 tasks
ghost opened this issue Sep 25, 2020 · 0 comments
Closed
5 tasks

after dump, stderr output disappear #2403

ghost opened this issue Sep 25, 2020 · 0 comments
Labels
solution: invalid the issue is not related to the library

Comments

@ghost
Copy link

ghost commented Sep 25, 2020

What is the issue you have?

json version: 3.7.3
source:
static int HanldeFailed(json& reply, json& result, std::string& err, const std::string& err_key, int has_err_key) {
fprintf(stderr, "xxxxx handler failed\n");
fprintf(stderr, "xxxxx call 44 %d field:%s,err:%d x\n", has_err_key, err_key.c_str(), err.size());
if (has_err_key) {
result.push_back(json {{err_key, err}});
reply["reply"] = result;
fprintf(stderr, "xxxxx handler failed 2\n");
std::string ss = result.dump();
fprintf(stderr, "xxxxx call 41 %s x\n", "soineweij");
return 0;
}
fprintf(stderr, "xxxxx call 42 %s x\n", "jiojonosnfie");
return -1;
}
output:
xxxxx handler failed
xxxxx call 44 1 field:ErrMsg,err:33 x
xxxxx handler failed 2
other:

  1. remove line of "std::string ss = result.dump();" , it work ok, output:
    xxxxx handler failed
    xxxxx call 44 1 field:ErrMsg,err:33 x
    xxxxx handler failed 2
    xxxxx call 41 soineweij x
  2. simple json demo cannot reproduce the issue
    i'm confused why it appears, please give some suggest to get where is wrong, thanks

Please describe the steps to reproduce the issue.

may not reproduce, but in my project is indeed exist every time

  1. nginx fprintf(stderr, ...) output to file

Can you provide a small but working code example?

What is the expected behavior?

And what is the actual behavior instead?

Which compiler and operating system are you using?

  • Compiler: ___
  • Operating system: ___

Which version of the library did you use?

  • latest release version 3.9.1
  • other release - please state the version: ___
  • the develop branch

If you experience a compilation error: can you compile and run the unit tests?

  • yes
  • no - please copy/paste the error message below
@ghost ghost added the kind: bug label Sep 25, 2020
@ghost ghost closed this as completed Sep 25, 2020
@nlohmann nlohmann added solution: invalid the issue is not related to the library and removed kind: bug labels Jan 1, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solution: invalid the issue is not related to the library
Projects
None yet
Development

No branches or pull requests

1 participant