Skip to content

Commit

Permalink
[MSA] Fix arg parsing in main (moveit#1110)
Browse files Browse the repository at this point in the history
  • Loading branch information
DLu authored and peterdavidfagan committed Jul 14, 2022
1 parent ab7d718 commit 0e8bc4e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion moveit_setup_assistant/moveit_setup_assistant/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ void usage(boost::program_options::options_description& desc, int exit_code)

int main(int argc, char** argv)
{
std::vector<std::string> remaining_args = rclcpp::remove_ros_arguments(argc, argv);
std::vector<char*> clean_argv;
clean_argv.reserve(remaining_args.size());
for (const std::string& arg : remaining_args)
{
clean_argv.push_back(const_cast<char*>(arg.c_str()));
}

// Parse parameters
namespace po = boost::program_options;

Expand All @@ -70,7 +78,7 @@ int main(int argc, char** argv)
po::variables_map vm;
try
{
po::store(po::parse_command_line(argc, argv, desc), vm);
po::store(po::parse_command_line(clean_argv.size(), &clean_argv[0], desc), vm);
po::notify(vm);

if (vm.count("help"))
Expand Down

0 comments on commit 0e8bc4e

Please sign in to comment.