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
12 #include "llvm/ADT/StringRef.h"
13 #include "llvm/Support/Error.h"
17 /// Redirects the output of a given file descriptor to a callback.
20 /// \a Error::success if the redirection was set up correctly, or an error
22 llvm::Error
RedirectFd(int fd
, std::function
<void(llvm::StringRef
)> callback
);
24 } // namespace lldb_dap
26 #endif // LLDB_TOOLS_LLDB_DAP_OUTPUT_REDIRECTOR_H