Use CPLIsInteractive()
This commit is contained in:
parent
997537270c
commit
1a3335bed6
|
@ -26,12 +26,6 @@
|
|||
|
||||
#include <cctype>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* GetSRSAsWKT */
|
||||
/************************************************************************/
|
||||
|
@ -300,7 +294,7 @@ MAIN_START(argc, argv)
|
|||
if (std::isnan(dfGeoX))
|
||||
{
|
||||
// Is it an interactive terminal ?
|
||||
if (isatty(static_cast<int>(fileno(stdin))))
|
||||
if (CPLIsInteractive(stdin))
|
||||
{
|
||||
if (!osSourceSRS.empty())
|
||||
{
|
||||
|
|
|
@ -30,12 +30,6 @@
|
|||
#include "ogr_srs_api.h"
|
||||
#include "commonutils.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* Usage() */
|
||||
/************************************************************************/
|
||||
|
@ -359,7 +353,7 @@ MAIN_START(argc, argv)
|
|||
if (!bCoordOnCommandLine)
|
||||
{
|
||||
// Is it an interactive terminal ?
|
||||
if (isatty(static_cast<int>(fileno(stdin))))
|
||||
if (CPLIsInteractive(stdin))
|
||||
{
|
||||
if (pszSrcFilename != nullptr)
|
||||
{
|
||||
|
|
|
@ -27,12 +27,6 @@
|
|||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <unistd.h> // isatty()
|
||||
#else
|
||||
#include <io.h> // _isatty()
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
@ -901,11 +895,7 @@ static bool IsGdalinfoInteractive()
|
|||
{
|
||||
static const bool bIsGdalinfoInteractive = []()
|
||||
{
|
||||
#ifndef _WIN32
|
||||
if (isatty(static_cast<int>(fileno(stdout))))
|
||||
#else
|
||||
if (_isatty(_fileno(stdout)))
|
||||
#endif
|
||||
if (CPLIsInteractive(stdout))
|
||||
{
|
||||
std::string osPath;
|
||||
osPath.resize(1024);
|
||||
|
|
|
@ -15,10 +15,6 @@
|
|||
|
||||
#include "cpl_error.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <unistd.h> // isatty()
|
||||
#endif
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
@ -1052,7 +1048,7 @@ void CPL_STDCALL CPLDefaultErrorHandler(CPLErr eErrClass, CPLErrorNum nError,
|
|||
#ifndef _WIN32
|
||||
CPLErrorContext *psCtx = CPLGetErrorContext();
|
||||
if (psCtx != nullptr && !IS_PREFEFINED_ERROR_CTX(psCtx) &&
|
||||
fpLog == stderr && isatty(static_cast<int>(fileno(stderr))))
|
||||
fpLog == stderr && CPLIsInteractive(stderr))
|
||||
{
|
||||
if (psCtx->bProgressMode)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue