mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-17 13:13:36 +00:00
Fix my own wrong command usage
This commit is contained in:
parent
5f3eca4cd1
commit
45cd535839
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user