Handle babel-node.es6, remove debug printf in rlang and autoinit io in rbin to ease scripts

This commit is contained in:
pancake 2015-03-25 12:49:10 +01:00
parent 95626e2aa4
commit c75192e435
3 changed files with 11 additions and 1 deletions

View File

@ -422,6 +422,10 @@ R_API int r_bin_load(RBin *bin, const char *file, ut64 baseaddr, ut64 loadaddr,
RIO *io;
RIODesc *desc = NULL;
io = (iob&&iob->get_io) ? iob->get_io(iob) : NULL;
if (!io) {
io = r_io_new ();
if (io) r_io_bind (io, &bin->iob);
}
if (!io) return R_FALSE;
bin->rawstr = rawstr;
desc = fd == -1 ? iob->desc_open (io, file, O_RDONLY, 0644) : iob->desc_get_by_fd (io, fd);

View File

@ -296,6 +296,12 @@ R_API int r_core_run_script (RCore *core, const char *file) {
r_lang_run_file (core->lang, cmd);
free (cmd);
ret = 1;
} else if (!strcmp (ext, "es6")) {
char *cmd = r_str_newf ("babel-node '%s'", file);
r_lang_use (core->lang, "pipe");
r_lang_run_file (core->lang, cmd);
free (cmd);
ret = 1;
} else if (!strcmp (ext, "py")) {
char *cmd = r_str_newf ("python '%s'", file);
r_lang_use (core->lang, "pipe");

View File

@ -70,7 +70,7 @@ static int lang_pipe_run(RLang *lang, const char *code, int len) {
}
buf[sizeof(buf)-1] = 0;
res = lang->cmd_str ((RCore*)lang->user, buf);
eprintf ("%d %s\n", ret, buf);
//eprintf ("%d %s\n", ret, buf);
if (res) {
write (input[1], res, strlen (res)+1);
free (res);