Skip to content

Commit

Permalink
fix(tests): improved error handling with subprocesses
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Scolaro <[email protected]>
  • Loading branch information
therealbobo committed Feb 16, 2024
1 parent 0009a01 commit b23361c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/libsinsp_e2e/subprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ limitations under the License.
#include <vector>
#include <string>
#include <cstring>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
Expand Down Expand Up @@ -62,7 +63,7 @@ subprocess::subprocess(const std::string& command, const std::vector<std::string
args.push_back(nullptr);

execvp(command.c_str(), args.data());
std::cerr << "Failed to execute the process." << std::endl;
std::cerr << "Failed to execute " << command << ": " << std::strerror(errno) << std::endl;
exit(EXIT_FAILURE);
}
else // Parent process
Expand Down

0 comments on commit b23361c

Please sign in to comment.