mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-22 20:59:50 +00:00
Add 'stdouterr' directive in rarun2 ##tools
This commit is contained in:
parent
2f84fcfa2f
commit
9f65b34eeb
@ -1,4 +1,4 @@
|
||||
/* radare2 - Copyleft 2011-2023 - pancake */
|
||||
/* radare2 - Copyleft 2011-2024 - pancake */
|
||||
|
||||
#include <r_main.h>
|
||||
|
||||
|
@ -258,6 +258,9 @@ typedef struct r_run_profile_t {
|
||||
int _timeout;
|
||||
int _timeout_sig;
|
||||
int _nice;
|
||||
#if R2_USE_NEW_ABI
|
||||
bool _stderrout;
|
||||
#endif
|
||||
} RRunProfile;
|
||||
|
||||
R_API RRunProfile *r_run_new(R_NULLABLE const char *str);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* radare2 - Copyleft 2011-2023 - pancake */
|
||||
/* radare2 - Copyleft 2011-2024 - pancake */
|
||||
|
||||
#define R_LOG_ORIGIN "rarun2"
|
||||
|
||||
|
@ -645,6 +645,13 @@ R_API bool r_run_parseline(RRunProfile *p, const char *b) {
|
||||
p->_seteuid = strdup (e);
|
||||
} else if (!strcmp (b, "setgid")) {
|
||||
p->_setgid = strdup (e);
|
||||
#if R2_USE_NEW_ABI
|
||||
} else if (!strcmp (b, "stderrout")) {
|
||||
p->_stderrout = r_str_is_true (e);
|
||||
#else
|
||||
} else if (!strcmp (b, "stderrout")) {
|
||||
R_LOG_ERROR ("stderrout directive is only supported in the new abi");
|
||||
#endif
|
||||
} else if (!strcmp (b, "setegid")) {
|
||||
p->_setegid = strdup (e);
|
||||
} else if (!strcmp (b, "nice")) {
|
||||
@ -747,6 +754,7 @@ R_API const char *r_run_help(void) {
|
||||
"# #core=false\n"
|
||||
"# #stdio=blah.txt\n"
|
||||
"# #stderr=foo.txt\n"
|
||||
"# #stderrout=false\n"
|
||||
"# stdout=foo.txt\n"
|
||||
"# stdin=input.txt # or !program to redirect input from another program\n"
|
||||
"# input=input.txt\n"
|
||||
@ -1082,15 +1090,26 @@ R_API bool r_run_config_env(RRunProfile *p) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#if R2_USE_NEW_ABI
|
||||
if (p->_stderrout) {
|
||||
#if __wasi__
|
||||
R_LOG_WARN ("Directive 'stderrout' not supported in wasm");
|
||||
#else
|
||||
if (dup2 (1, 2) == -1) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (p->_setgid) {
|
||||
#if __wasi__
|
||||
ret = 0;
|
||||
R_LOG_WARN ("Directive 'setgid' not supported in wasm");
|
||||
#else
|
||||
ret = setgid (atoi (p->_setgid));
|
||||
#endif
|
||||
if (ret < 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (p->_input) {
|
||||
char *inp;
|
||||
|
@ -82,6 +82,8 @@ set effective process group id
|
||||
set effective process uid
|
||||
.It Ar setgid
|
||||
set process group id
|
||||
.It Ar stderrout true|false
|
||||
Redirect stderr filedescriptor to stdout
|
||||
.It Ar setuid
|
||||
set process uid
|
||||
.It Ar sleep
|
||||
|
Loading…
Reference in New Issue
Block a user