Fossil SCM

Make sure stdin and stdout are set to binary mode in Windows for the "fossil http" command.

drh 2022-01-26 18:22 trunk
Commit be1c4d47f9a28743e9197c65b038569d7a116304a4713718ffbb911b28824bb9
1 file changed +6
+6
--- src/main.c
+++ src/main.c
@@ -2729,17 +2729,23 @@
27292729
backoffice_disable();
27302730
g.httpIn = fossil_fopen(zInFile, "rb");
27312731
if( g.httpIn==0 ) fossil_fatal("cannot open \"%s\" for reading", zInFile);
27322732
}else{
27332733
g.httpIn = stdin;
2734
+#if defined(_WIN32)
2735
+ _setmode(_fileno(stdin), _O_BINARY);
2736
+#endif
27342737
}
27352738
zOutFile = find_option("out",0,1);
27362739
if( zOutFile ){
27372740
g.httpOut = fossil_fopen(zOutFile, "wb");
27382741
if( g.httpOut==0 ) fossil_fatal("cannot open \"%s\" for writing", zOutFile);
27392742
}else{
27402743
g.httpOut = stdout;
2744
+#if defined(_WIN32)
2745
+ _setmode(_fileno(stdout), _O_BINARY);
2746
+#endif
27412747
}
27422748
zIpAddr = find_option("ipaddr",0,1);
27432749
useSCGI = find_option("scgi", 0, 0)!=0;
27442750
zAltBase = find_option("baseurl", 0, 1);
27452751
if( find_option("nodelay",0,0)!=0 ) backoffice_no_delay();
27462752
--- src/main.c
+++ src/main.c
@@ -2729,17 +2729,23 @@
2729 backoffice_disable();
2730 g.httpIn = fossil_fopen(zInFile, "rb");
2731 if( g.httpIn==0 ) fossil_fatal("cannot open \"%s\" for reading", zInFile);
2732 }else{
2733 g.httpIn = stdin;
 
 
 
2734 }
2735 zOutFile = find_option("out",0,1);
2736 if( zOutFile ){
2737 g.httpOut = fossil_fopen(zOutFile, "wb");
2738 if( g.httpOut==0 ) fossil_fatal("cannot open \"%s\" for writing", zOutFile);
2739 }else{
2740 g.httpOut = stdout;
 
 
 
2741 }
2742 zIpAddr = find_option("ipaddr",0,1);
2743 useSCGI = find_option("scgi", 0, 0)!=0;
2744 zAltBase = find_option("baseurl", 0, 1);
2745 if( find_option("nodelay",0,0)!=0 ) backoffice_no_delay();
2746
--- src/main.c
+++ src/main.c
@@ -2729,17 +2729,23 @@
2729 backoffice_disable();
2730 g.httpIn = fossil_fopen(zInFile, "rb");
2731 if( g.httpIn==0 ) fossil_fatal("cannot open \"%s\" for reading", zInFile);
2732 }else{
2733 g.httpIn = stdin;
2734 #if defined(_WIN32)
2735 _setmode(_fileno(stdin), _O_BINARY);
2736 #endif
2737 }
2738 zOutFile = find_option("out",0,1);
2739 if( zOutFile ){
2740 g.httpOut = fossil_fopen(zOutFile, "wb");
2741 if( g.httpOut==0 ) fossil_fatal("cannot open \"%s\" for writing", zOutFile);
2742 }else{
2743 g.httpOut = stdout;
2744 #if defined(_WIN32)
2745 _setmode(_fileno(stdout), _O_BINARY);
2746 #endif
2747 }
2748 zIpAddr = find_option("ipaddr",0,1);
2749 useSCGI = find_option("scgi", 0, 0)!=0;
2750 zAltBase = find_option("baseurl", 0, 1);
2751 if( find_option("nodelay",0,0)!=0 ) backoffice_no_delay();
2752

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button