Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,21 @@ public int Start(string consoleFilePath, string[] args)
int exitCode = 0;
try
{
#if CORECLR
exitCode = Microsoft.PowerShell.ConsoleShell.Start(
configuration,
ManagedEntranceStrings.ShellBannerNonWindowsPowerShell,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not have just guarded this one line?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not a fan of preprocessor directives inside method calls. That said, it would be cleaner to use a local variable, like:

#if CORECLR
var banner = ...
#else
var banner = ...
#endif
exitCode = Microsoft.PowerShell.ConsoleShell.Start(
    configuration,
    banner,
...

ManagedEntranceStrings.ShellHelp,
warning == null ? null : warning.Message,
args);
#else
exitCode = Microsoft.PowerShell.ConsoleShell.Start(
configuration,
ManagedEntranceStrings.ShellBanner,
ManagedEntranceStrings.ShellHelp,
warning == null ? null : warning.Message,
args);
#endif
}
catch (System.Management.Automation.Host.HostException e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@
</resheader>
<data name="ShellBanner" xml:space="preserve">
<value>Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.</value>
</data>
<data name="ShellBannerNonWindowsPowerShell" xml:space="preserve">
<value>PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.</value>
</data>
<data name="ShellHelp" xml:space="preserve">
Expand Down