Some Windows quality of life improvments. (#846)

* Don't try to ignore SIGPIPE in Windows (it doesn't exist).
* Add an include to our win32.h compatibility header.
* Enable building examples on Travis in Windows.

See #831
This commit is contained in:
Michael Grunder 2020-07-10 12:53:52 -07:00 committed by GitHub
parent ada3665279
commit 1864e76ea7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 2 deletions

View File

@ -108,5 +108,5 @@ jobs:
script: script:
- mkdir build && cd build - mkdir build && cd build
- cmd.exe //C 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat' amd64 '&&' - cmd.exe //C 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat' amd64 '&&'
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release '&&' ninja -v cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_EXAMPLES=ON '&&' ninja -v
- ./hiredis-test.exe - ./hiredis-test.exe

View File

@ -33,7 +33,9 @@ void disconnectCallback(const redisAsyncContext *c, int status) {
} }
int main (int argc, char **argv) { int main (int argc, char **argv) {
#ifndef _WIN32
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);
#endif
iv_init(); iv_init();

View File

@ -33,7 +33,9 @@ void disconnectCallback(const redisAsyncContext *c, int status) {
} }
int main (int argc, char **argv) { int main (int argc, char **argv) {
#ifndef _WIN32
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);
#endif
redisAsyncContext *c = redisAsyncConnect("127.0.0.1", 6379); redisAsyncContext *c = redisAsyncConnect("127.0.0.1", 6379);
if (c->err) { if (c->err) {

View File

@ -34,7 +34,10 @@ void disconnectCallback(const redisAsyncContext *c, int status) {
} }
int main (int argc, char **argv) { int main (int argc, char **argv) {
#ifndef _WIN32
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);
#endif
struct event_base *base = event_base_new(); struct event_base *base = event_base_new();
if (argc < 5) { if (argc < 5) {
fprintf(stderr, fprintf(stderr,

View File

@ -38,7 +38,10 @@ void disconnectCallback(const redisAsyncContext *c, int status) {
} }
int main (int argc, char **argv) { int main (int argc, char **argv) {
#ifndef _WIN32
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);
#endif
struct event_base *base = event_base_new(); struct event_base *base = event_base_new();
redisOptions options = {0}; redisOptions options = {0};
REDIS_OPTIONS_SET_TCP(&options, "127.0.0.1", 6379); REDIS_OPTIONS_SET_TCP(&options, "127.0.0.1", 6379);

View File

@ -33,7 +33,10 @@ void disconnectCallback(const redisAsyncContext *c, int status) {
} }
int main (int argc, char **argv) { int main (int argc, char **argv) {
#ifndef _WIN32
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);
#endif
uv_loop_t* loop = uv_default_loop(); uv_loop_t* loop = uv_default_loop();
redisAsyncContext *c = redisAsyncConnect("127.0.0.1", 6379); redisAsyncContext *c = redisAsyncConnect("127.0.0.1", 6379);

View File

@ -4,6 +4,7 @@
#include <hiredis.h> #include <hiredis.h>
#include <hiredis_ssl.h> #include <hiredis_ssl.h>
#include <win32.h>
int main(int argc, char **argv) { int main(int argc, char **argv) {
unsigned int j; unsigned int j;

View File

@ -1,8 +1,8 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <hiredis.h> #include <hiredis.h>
#include <win32.h>
int main(int argc, char **argv) { int main(int argc, char **argv) {
unsigned int j, isunix = 0; unsigned int j, isunix = 0;