1 //===-- OutputRedirector.h -------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===/
9 #ifndef LLDB_TOOLS_LLDB_DAP_OUTPUT_REDIRECTOR_H
10 #define LLDB_TOOLS_LLDB_DAP_OUTPUT_REDIRECTOR_H
14 #include "llvm/ADT/StringRef.h"
15 #include "llvm/Support/Error.h"
19 /// Redirects the output of a given file descriptor to a callback.
22 /// \a Error::success if the redirection was set up correctly, or an error
24 llvm::Error
RedirectFd(int fd
, std::function
<void(llvm::StringRef
)> callback
);
26 } // namespace lldb_dap
28 #endif // LLDB_TOOLS_LLDB_DAP_OUTPUT_REDIRECTOR_H