Skip to content

Commit

Permalink
Trim whitespace when parsing determining script lines
Browse files Browse the repository at this point in the history
  • Loading branch information
anamnavi committed Oct 23, 2023
1 parent 2efac58 commit e01734d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/code/PSScriptFileInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ internal static bool TryParseScriptFileContents(
{
string line = fileContents[i];

if (line.StartsWith("<#PSScriptInfo"))
if (line.Trim().StartsWith("<#PSScriptInfo"))
{
int j = i + 1; // start at the next line
// keep grabbing lines until we get to closing #>
while (j < fileContents.Length)
{
string blockLine = fileContents[j];
psScriptInfoCommentContent.Add(blockLine);
if (blockLine.StartsWith("#>"))
if (blockLine.Trim().StartsWith("#>"))
{

reachedPSScriptInfoCommentEnd = true;
Expand All @@ -157,7 +157,7 @@ internal static bool TryParseScriptFileContents(
return false;
}
}
else if (line.StartsWith("<#"))
else if (line.Trim().StartsWith("<#"))
{
// The next comment block must be the help comment block (containing description)
// keep grabbing lines until we get to closing #>
Expand All @@ -166,7 +166,7 @@ internal static bool TryParseScriptFileContents(
{
string blockLine = fileContents[j];

if (blockLine.StartsWith("#>"))
if (blockLine.Trim().StartsWith("#>"))
{
reachedHelpInfoCommentEnd = true;
i = j + 1;
Expand Down

0 comments on commit e01734d

Please sign in to comment.