mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-17 12:48:41 +00:00
Fix ?*>
dumping to screen ##shell
This commit is contained in:
parent
32afc6e5d3
commit
4ceb8ebba3
@ -39,7 +39,7 @@ R_API int r_cons_pipe_open(const char *file, int fdn, int append) {
|
||||
const int fd_flags = O_BINARY | O_RDWR | O_CREAT | (append? O_APPEND: O_TRUNC);
|
||||
int fd = r_sandbox_open (targetFile, fd_flags, 0644);
|
||||
if (fd == -1) {
|
||||
R_LOG_ERROR ("Cannot open file '%s'", file);
|
||||
R_LOG_ERROR ("ConsPipe cannot open file '%s'", file);
|
||||
free (targetFile);
|
||||
return -1;
|
||||
}
|
||||
|
@ -4270,6 +4270,29 @@ escape_pipe:
|
||||
|
||||
ptr = strstr (cmd, "?*");
|
||||
if (ptr && (ptr == cmd || ptr[-1] != '~')) {
|
||||
char *pipechar = strchr (ptr, '>');
|
||||
if (pipechar) {
|
||||
*pipechar++ = 0;
|
||||
const bool appendResult = *pipechar == '>';
|
||||
const char *pipefile = r_str_trim_head_ro (appendResult? pipechar + 1: pipechar);
|
||||
int pipefd = r_cons_pipe_open (pipefile, 1, appendResult);
|
||||
if (pipefd != -1) {
|
||||
int scr_color = -1;
|
||||
bool pipecolor = r_config_get_b (core->config, "scr.color.pipe");
|
||||
if (!pipecolor) {
|
||||
scr_color = r_config_get_i (core->config, "scr.color");
|
||||
r_config_set_i (core->config, "scr.color", COLOR_MODE_DISABLED);
|
||||
}
|
||||
ret = r_core_cmd_subst (core, cmd);
|
||||
r_cons_flush ();
|
||||
close (pipefd);
|
||||
r_cons_pipe_close (pipefd);
|
||||
if (!pipecolor) {
|
||||
r_config_set_i (core->config, "scr.color", scr_color);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
ptr[0] = 0;
|
||||
if (*cmd != '#') {
|
||||
int detail = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user