| 110 | } |
| 111 | |
| 112 | int main(int argc, char* argv[]) try { |
| 113 | // Create a CompletionQueue to demux the I/O and other asynchronous |
| 114 | // operations, and dedicate a thread to it. |
| 115 | g::CompletionQueue cq; |
| 116 | auto runner = std::thread{[](auto cq) { cq.Run(); }, cq}; |
| 117 | // Shutdown the completion queue and join the thread. |
| 118 | std::shared_ptr<void> auto_shutdown(nullptr, [&](void*) { |
| 119 | cq.Shutdown(); |
| 120 | runner.join(); |
| 121 | }); |
| 122 | |
| 123 | // Run a streaming transcription. Note that `.get()` blocks until it |
| 124 | // completes. |
| 125 | auto status = StreamingTranscribe(cq, ParseArguments(argc, argv)).get(); |
| 126 | |
| 127 | if (!status.ok()) { |
| 128 | std::cerr << "Error in transcribe stream: " << status << "\n"; |
| 129 | return 1; |
| 130 | } |
| 131 | return 0; |
| 132 | } catch (std::exception const& ex) { |
| 133 | std::cerr << "Standard C++ exception thrown: " << ex.what() << "\n" |
| 134 | << kUsage << "\n"; |
| 135 | return 1; |
| 136 | } |
nothing calls this directly
no test coverage detected