File tree Expand file tree Collapse file tree 1 file changed +3
-19
lines changed
Expand file tree Collapse file tree 1 file changed +3
-19
lines changed Original file line number Diff line number Diff line change @@ -785,13 +785,9 @@ static char *tool_run_javascript(ServerState *ss, RJson *tool_args) {
785785 }
786786
787787 char * cmd = r_str_newf ("js base64:%s" , encoded );
788-
789788 char * res = r2mcp_cmd (ss , cmd );
790-
791789 free (cmd );
792-
793790 free (encoded );
794-
795791 return tool_cmd_response (res );
796792}
797793
@@ -804,22 +800,10 @@ static char *tool_list_sessions(ServerState *ss, RJson *tool_args) {
804800 // In HTTP mode, we can't run r2agent locally, return empty result
805801 res = strdup ("[]" );
806802 } else {
807- // Run r2agent command directly using system
808- FILE * fp = popen ( "r2agent -Lj 2>/dev/null" , "r" );
809- if (! fp ) {
803+ res = r_sys_cmd_str ( " r2agent -Lj 2>/dev/null" , NULL , NULL );
804+ if ( R_STR_ISEMPTY ( res )) {
805+ free ( res );
810806 res = strdup ("[]" );
811- } else {
812- char buffer [4096 ];
813- RStrBuf * sb = r_strbuf_new ("" );
814- while (fgets (buffer , sizeof (buffer ), fp )) {
815- r_strbuf_append (sb , buffer );
816- }
817- pclose (fp );
818- res = r_strbuf_drain (sb );
819- if (R_STR_ISEMPTY (res )) {
820- free (res );
821- res = strdup ("[]" );
822- }
823807 }
824808 }
825809 return tool_cmd_response (res );
You can’t perform that action at this time.
0 commit comments