Reformat remwharead_wrapper.cpp.
This commit is contained in:
parent
4e9e750e35
commit
a198f1323a
|
@ -15,18 +15,19 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Poco/Message.h>
|
#include <Poco/Message.h>
|
||||||
#include <string>
|
#include <sys/wait.h>
|
||||||
#include <iostream>
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <sys/wait.h>
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
using std::string;
|
|
||||||
using std::cin;
|
using std::cin;
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::uint32_t;
|
using std::string;
|
||||||
using std::system;
|
using std::system;
|
||||||
|
using std::uint32_t;
|
||||||
|
|
||||||
class Message
|
class Message
|
||||||
{
|
{
|
||||||
|
@ -35,8 +36,7 @@ public:
|
||||||
Message();
|
Message();
|
||||||
|
|
||||||
//! Decode message and return argument string for launch().
|
//! Decode message and return argument string for launch().
|
||||||
[[nodiscard]]
|
[[nodiscard]] string decode();
|
||||||
string decode();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
string _msg;
|
string _msg;
|
||||||
|
@ -54,7 +54,6 @@ void send_message(const string &message);
|
||||||
//! Launch remwharead with args.
|
//! Launch remwharead with args.
|
||||||
int launch(const string &args);
|
int launch(const string &args);
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
Message message;
|
Message message;
|
||||||
|
@ -68,8 +67,8 @@ int main()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
send_message("Command failed with status: "
|
send_message("Command failed with status: " + std::to_string(ret)
|
||||||
+ std::to_string(ret) + '.');
|
+ '.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -143,7 +142,7 @@ void send_message(const string &message)
|
||||||
{
|
{
|
||||||
const auto length = static_cast<uint32_t>(message.length() + 2);
|
const auto length = static_cast<uint32_t>(message.length() + 2);
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
|
||||||
cout.write(reinterpret_cast<const char*>(&length), sizeof(uint32_t));
|
cout.write(reinterpret_cast<const char *>(&length), sizeof(uint32_t));
|
||||||
cout << '"' << message << '"';
|
cout << '"' << message << '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +151,7 @@ int launch(const string &args)
|
||||||
const string cmd = "remwharead " + args + " 2>/dev/null";
|
const string cmd = "remwharead " + args + " 2>/dev/null";
|
||||||
// NOLINTNEXTLINE(cert-env33-c)
|
// NOLINTNEXTLINE(cert-env33-c)
|
||||||
int ret = system(cmd.c_str());
|
int ret = system(cmd.c_str());
|
||||||
if (WIFEXITED(ret)) // NOLINT(hicpp-signed-bitwise)
|
if (WIFEXITED(ret)) // NOLINT(hicpp-signed-bitwise)
|
||||||
{
|
{
|
||||||
ret = WEXITSTATUS(ret); // NOLINT(hicpp-signed-bitwise)
|
ret = WEXITSTATUS(ret); // NOLINT(hicpp-signed-bitwise)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue