| 398 | } |
| 399 | |
| 400 | void OpenUrl(const Options& opts, absl::string_view url) { |
| 401 | std::cout << url << std::endl; |
| 402 | |
| 403 | // If it is a url, try to open it up in the user's browser too. |
| 404 | if (absl::StartsWithIgnoreCase(url, "http://") || |
| 405 | absl::StartsWithIgnoreCase(url, "https://") || |
| 406 | absl::StartsWithIgnoreCase(url, "file://")) { |
| 407 | const char* browser_bin = opts.browser.empty() ? "/usr/bin/sensible-browser" |
| 408 | : opts.browser.c_str(); |
| 409 | tensorflow::SubProcess p; |
| 410 | p.SetProgram(browser_bin, {browser_bin, string(url)}); |
| 411 | p.Start(); |
| 412 | } else { |
| 413 | std::cerr << "\nExpected a URL, but got strange graph result (dumped " |
| 414 | "above). If this isn't what you expected, maybe file a bug?" |
| 415 | << std::endl; |
| 416 | } |
| 417 | } |
| 418 | |
| 419 | // Renders a graph by calling `renderer`, and then tries to open it. |
| 420 | // |
no test coverage detected