GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — extractor.cpp/main.cpp at master · algorithm-visualizer/extractor.cpp Expand file tree/ Copy pathmain.cppMore file actions 42 lines (36 loc) · 1.12 KB / Copy pathmain.cppFile metadata and controls42 lines (36 loc) · 1.12 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 #include <aws/lambda-runtime/runtime.h> #include <cstdio> #include <iostream> #include <memory> #include <stdexcept> #include <string> #include <array> using namespace aws::lambda_runtime; std::string exec(const char* cmd) { std::array<char, 128> buffer; std::string result; std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd, "r"), pclose); if (!pipe) { throw std::runtime_error("popen() failed!"); } while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) { result += buffer.data(); } return result; } static invocation_response handle_request(invocation_request const& req) { std::cout << exec("whereis g++"); std::cout << exec("echo \"blahkhgfd\""); if (req.payload.length() > 42) { return invocation_response::failure("error message here"/*error_message*/, "error type here" /*error_type*/); } return invocation_response::success("json payload here" /*payload*/, "application/json" /*MIME type*/); } int main() { run_handler(handle_request); return 0; } |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |