function show_result(mp, msg) mod_query.message(mp, msg) end function my_exec_handler(mp, cmd) ioncore.defer( function () local f = io.popen(cmd, 'r') if not f then show_result(mp, 'error executing command: ' .. cmd) return end local s = f:read('*a') if s then show_result(mp, s) else show_result(mp, 'no output') end f:close() end ) end function exec_and_show(mplex) mod_query.query(mplex, TR("Exec and display:"), nil, my_exec_handler, mod_query.exec_completor, "execdisplay") end defbindings("WMPlex", { bdoc("Execute a command and show the result."), kpress(MOD1.."F4", "exec_and_show(_)"), })