Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cppdap
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
cppdap
Commits
ced82a05
Commit
ced82a05
authored
Jan 17, 2020
by
Ben Clayton
Committed by
Ben Clayton
Jan 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples: Change stdin and stdout to binary mode
On windows text mode for these plays with newline escape sequences, breaking the ContextStream encoding. Fixes: #12
parent
96b25aaf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
hello_debugger.cpp
examples/hello_debugger.cpp
+17
-1
No files found.
examples/hello_debugger.cpp
View file @
ced82a05
...
...
@@ -24,11 +24,20 @@
#include <mutex>
#include <unordered_set>
#ifdef _MSC_VER
#define OS_WINDOWS 1
#endif
// Uncomment the line below and change <path-to-log-file> to a file path to
// write all DAP communications to the given path.
//
// #define LOG_TO_FILE "<path-to-log-file>"
#ifdef OS_WINDOWS
#include <fcntl.h> // _O_BINARY
#include <io.h> // _setmode
#endif // OS_WINDOWS
namespace
{
// sourceContent holds the synthetic file source.
...
...
@@ -147,7 +156,14 @@ void Event::fire() {
}
// anonymous namespace
// main() entry point to the DAP server.
int
main
(
int
,
char
*
[])
{
int
main
(
int
,
char
*
[])
{
#ifdef OS_WINDOWS
// Change stdin & stdout from text mode to binary mode.
// This ensures sequences of \r\n are not changed to \n.
_setmode
(
_fileno
(
stdin
),
_O_BINARY
);
_setmode
(
_fileno
(
stdout
),
_O_BINARY
);
#endif // OS_WINDOWS
std
::
shared_ptr
<
dap
::
Writer
>
log
;
#ifdef LOG_TO_FILE
log
=
dap
::
file
(
LOG_TO_FILE
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment