blob: c728367a218553324416917ac8d9834d289775f2 [file] [log] [blame]
//===-- OutputRedirector.h -------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===/
#ifndef LLDB_TOOLS_LLDB_VSCODE_OUTPUT_REDIRECTOR_H
#define LLDB_TOOLS_LLDB_VSCODE_OUTPUT_REDIRECTOR_H
#include <thread>
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Error.h"
namespace lldb_vscode {
/// Redirects the output of a given file descriptor to a callback.
///
/// \return
/// \a Error::success if the redirection was set up correctly, or an error
/// otherwise.
llvm::Error RedirectFd(int fd, std::function<void(llvm::StringRef)> callback);
} // namespace lldb_vscode
#endif // LLDB_TOOLS_LLDB_VSCODE_OUTPUT_REDIRECTOR_H