Fixed bug with argument parsing that was preventing register and unregister#1707
Fixed bug with argument parsing that was preventing register and unregister#1707bhillowasa wants to merge 1 commit intoDevolutions:masterfrom
Conversation
service from working.
| let action = match remaining_args.first().map(String::as_str) { | ||
| Some("--service") => CliAction::Run { service_mode: true }, | ||
| Some("service") => match args.next().as_deref() { | ||
| Some("service") => match remaining_args.get(1).map(String::as_str) { |
There was a problem hiding this comment.
The original code looks correct. Can you provide more information?
There was a problem hiding this comment.
The original code was calling args.next but the problem is that the args iterator was already consumed and its values pushed to remaining_args earlier on in the code.
I ran into this issue when I was installing the latest RPM on AlmaLinux; the pre and post scripts were failing. Calling /usr/bin/devolutions_gateway service register or /usr/bin/devolutions_gateway service unregister with the original code simply resulted in nothing happening except the execution falling through to CliAction::ShowHelp.
There was a problem hiding this comment.
Oh! I see. The bug seems to have been introduced by this commit: 3bcff86
The new code is quite convoluted, so I would rather update the whole parsing logic to something better.
There was a problem hiding this comment.
I’m sending a patch for that.
service from working.
This prevents it from installing in Linux environments, as the SystemD service is never created.