radare2/test/unit/test_cmd_str.c
ab1030 5206c636f5
Fix #18799 - r2pipe command output not always captured (#18800)
* put console in noflush mode in r_core_cmd_str to avoid flushing the console buffer
  when the output of the executed commands is retreived as a string.
* add in_cmdstr field to struct r_core_t which is internally used in r_core_cmd_str
* Add a unit test
2021-06-04 12:07:56 +02:00

20 lines
429 B
C

#include <r_core.h>
#include "minunit.h"
bool test_cmd_str_issue_18799() {
RCore *core = r_core_new ();
char *output = r_core_cmd_str (core, "pd 1 @e:asm.hints=false");
mu_assert ("command output leaked to stdout", strlen (output) > 0);
r_core_free (core);
mu_end;
}
int all_tests() {
mu_run_test (test_cmd_str_issue_18799);
return tests_passed != tests_run;
}
int main(int argc, char **argv) {
return all_tests ();
}