Skip to content

Commit 02cc2cd

Browse files
Fix HtmlValidateCli.GetInstalledVersion() method to return null when the package is not installed
1 parent 1b2d161 commit 02cc2cd

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- Upgrade `Atata.Cli` package to v1.2.0.
1313
- Upgrade `Atata.Cli.Npm` package to v1.2.0.
1414

15+
## Fixed
16+
17+
- Fix `HtmlValidateCli.GetInstalledVersion()` method to return `null` when the package is not installed.
18+
1519
## [1.1.0] - 2021-07-13
1620

1721
### Added

src/Atata.Cli.HtmlValidate/HtmlValidateCli.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,14 @@ private string ReadOutputFromFile(string filePath)
8282
return File.ReadAllText(fullFilePath);
8383
}
8484

85-
public override string GetInstalledVersion() =>
86-
Execute("--version").Output.Split('-').Last();
85+
/// <inheritdoc cref="GlobalNpmPackageCli{TCli}.GetInstalledVersion"/>
86+
public override string GetInstalledVersion()
87+
{
88+
CliCommandResult versionCommandResult = ExecuteRaw("--version");
89+
90+
return versionCommandResult.HasError
91+
? null
92+
: versionCommandResult.Output.Split('-').Last();
93+
}
8794
}
8895
}

0 commit comments

Comments
 (0)