Fix windows binary pipe using _setmode

pull/29/head
Paulo Dutra - PU4THZ 2022-08-17 01:10:08 -03:00 zatwierdzone przez GitHub
rodzic df7567bd6d
commit a75deb0067
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 58 dodań i 0 usunięć

Wyświetl plik

@ -19,6 +19,11 @@
#include <iostream>
#include <vector>
#ifdef WIN32
#include <io.h>
#include <fcntl.h>
#endif
const char VERSION[] = "2.2";
bool display_lsf = false;
@ -438,6 +443,22 @@ int main(int argc, char* argv[])
{
using namespace mobilinkd;
using namespace std::string_literals;
#ifdef WIN32
// Set "stdin" to have binary mode:
auto result = _setmode( _fileno( stdin ), _O_BINARY );
if( result == -1 )
perror( "Cannot set mode" );
else
std::cerr << "'stdin' successfully changed to binary mode\n";
// Set "stdout" to have binary mode:
result = _setmode( _fileno( stdout ), _O_BINARY );
if( result == -1 )
perror( "Cannot set mode" );
else
std::cerr << "'stdout' successfully changed to binary mode\n";
#endif
auto config = Config::parse(argc, argv);
if (!config) return 0;

Wyświetl plik

@ -30,6 +30,11 @@
#include <cstdlib>
#ifdef WIN32
#include <io.h>
#include <fcntl.h>
#endif
#include <signal.h>
// Generated using scikit-commpy
@ -628,6 +633,22 @@ void transmit(queue_t& queue, const lsf_t& lsf)
int main(int argc, char* argv[])
{
using namespace mobilinkd;
#ifdef WIN32
// Set "stdin" to have binary mode:
auto result = _setmode( _fileno( stdin ), _O_BINARY );
if( result == -1 )
perror( "Cannot set mode" );
else
std::cerr << "'stdin' successfully changed to binary mode\n";
// Set "stdout" to have binary mode:
result = _setmode( _fileno( stdout ), _O_BINARY );
if( result == -1 )
perror( "Cannot set mode" );
else
std::cerr << "'stdout' successfully changed to binary mode\n";
#endif
auto config = Config::parse(argc, argv);
if (!config) return 0;
@ -687,6 +708,22 @@ int main(int argc, char* argv[])
{
using namespace mobilinkd;
using namespace std::chrono_literals;
#ifdef WIN32
// Set "stdin" to have binary mode:
auto result = _setmode( _fileno( stdin ), _O_BINARY );
if( result == -1 )
perror( "Cannot set mode" );
else
std::cerr << "'stdin' successfully changed to binary mode\n";
// Set "stdout" to have binary mode:
result = _setmode( _fileno( stdout ), _O_BINARY );
if( result == -1 )
perror( "Cannot set mode" );
else
std::cerr << "'stdout' successfully changed to binary mode\n";
#endif
auto config = Config::parse(argc, argv);
if (!config) return 0;