Fix my own wrong command usage

This commit is contained in:
alesapin 2021-11-17 15:44:07 +03:00
parent 5f3eca4cd1
commit 45cd535839
2 changed files with 8 additions and 26 deletions

View File

@ -9,6 +9,7 @@
int getCurrentProcessFDCount()
{
int result = -1;
#if defined(__linux__) || defined(__APPLE__)
using namespace DB;
@ -21,6 +22,7 @@ int getCurrentProcessFDCount()
try
{
readIntText(result, command->out);
command->wait();
}
catch (...)
@ -31,25 +33,13 @@ int getCurrentProcessFDCount()
try
{
readIntText(result, command->out);
command->wait();
}
catch (...)
{
return -1;
}
}
WriteBufferFromOwnString out;
copyData(command->out, out);
if (!out.str().empty())
{
return parse<Int32>(out.str());
}
return -1;
#else
return -1;
#endif
return result;
}

View File

@ -6,29 +6,21 @@
int getMaxFileDescriptorCount()
{
int result = -1;
#if defined(__linux__) || defined(__APPLE__)
using namespace DB;
auto command = ShellCommand::execute("ulimit -n");
try
{
readIntText(result, command->out);
command->wait();
}
catch (...)
{
return -1;
}
WriteBufferFromOwnString out;
copyData(command->out, out);
if (!out.str().empty())
{
return parse<Int32>(out.str());
}
return -1;
#else
return -1;
#endif
return result;
}