Skip to content

Fix startup bug when zero profiles are present - #1807

Merged
Andy Jordan (andyleejordan) merged 1 commit into
masterfrom
andschwa/no-profiles
May 19, 2022
Merged

Fix startup bug when zero profiles are present#1807
Andy Jordan (andyleejordan) merged 1 commit into
masterfrom
andschwa/no-profiles

Conversation

@andyleejordan

Copy link
Copy Markdown
Member

The service would fail to fully start if zero profiles were present, because that meant we attempted to invoke an empty command, which then threw PSInvalidOperationException: No commands are specified. This wasn't caught by our task executor, since it happened in a delegate which directly invoked the command.

The service would fail to fully start if zero profiles were present,
because that meant we attempted to invoke an empty command, which then
threw `PSInvalidOperationException: No commands are specified`. This
wasn't caught by our task executor, since it happened in a delegate
which directly invoked the command.
// false` to avoid an exception here. Instead, we must just not execute it.
if (psCommand.Commands.Count > 0)
{
pwsh.InvokeCommand(psCommand);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Patrick Meinecke (@SeeminglyScience) we should check everywhere else we directly invoke too.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants