Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/jqPublic

Commit0dab2b1

Browse files
committed
Add -b / --binary option for Windows
1 parent3e0a118 commit0dab2b1

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

‎docs/content/manual/manual.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ sections:
164164
Colors can be configured with the `JQ_COLORS` environment
165165
variable (see below).
166166
167+
* `--binary` / `-b`:
168+
169+
Windows users using WSL, MSYS2, or Cygwin, should use this option
170+
when using a native jq.exe, otherwise jq will turn newlines (LFs)
171+
into carriage-return-then-newline (CRLF).
172+
167173
* `--ascii-output` / `-a`:
168174
169175
jq usually outputs non-ASCII Unicode codepoints as UTF-8, even

‎src/main.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,16 @@ int main(int argc, char* argv[]) {
394394
options |=RAW_OUTPUT |RAW_NO_LF;
395395
if (!short_opts)continue;
396396
}
397+
if (isoption(argv[i],'b',"binary",&short_opts)) {
398+
#ifdefWIN32
399+
fflush(stdout);
400+
fflush(stderr);
401+
_setmode(fileno(stdin),_O_BINARY);
402+
_setmode(fileno(stdout),_O_BINARY);
403+
_setmode(fileno(stderr),_O_BINARY);
404+
if (!short_opts)continue;
405+
#endif
406+
}
397407
if (isoption(argv[i],0,"tab",&short_opts)) {
398408
dumpopts &= ~JV_PRINT_INDENT_FLAGS(7);
399409
dumpopts |=JV_PRINT_TAB |JV_PRINT_PRETTY;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp