Skip to content
This repository was archived by the owner on Nov 15, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Extracted service start timeout to CommandLineParser
  • Loading branch information
molnargab committed Jun 10, 2015
commit 42c3a7e711621c54df7273cfc9526d00185f2443
2 changes: 1 addition & 1 deletion main/OpenCover.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ private static void RunService(CommandLineParser parser, Action<StringDictionary
service.Start();
}
logger.InfoFormat("Service starting '{0}'", parser.Target);
service.WaitForStatus(ServiceControllerStatus.Running, new TimeSpan(0, 0, 30));
service.WaitForStatus(ServiceControllerStatus.Running, parser.ServiceStartTimeout);
logger.InfoFormat("Service started '{0}'", parser.Target);
}
catch (InvalidOperationException fault)
Expand Down
6 changes: 6 additions & 0 deletions main/OpenCover.Framework/CommandLineParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public CommandLineParser(string[] arguments)
EnablePerformanceCounters = false;
TraceByTest = false;
ServiceEnvironment = ServiceEnvironment.None;
ServiceStartTimeout = new TimeSpan(0, 0, 30);
RegExFilters = false;
Registration = Registration.Normal;
PrintVersion = false;
Expand Down Expand Up @@ -436,6 +437,11 @@ private void ValidateArguments()
/// </summary>
public ServiceEnvironment ServiceEnvironment { get; private set; }

/// <summary>
/// Gets the timeout to wait for the service to start up
/// </summary>
public TimeSpan ServiceStartTimeout { get; private set; }

/// <summary>
/// Use the old style of instrumentation that even though not APTCA friendly will
/// work when - ngen install /Profile "mscorlib" - has been used
Expand Down
1 change: 1 addition & 0 deletions main/OpenCover.Test/Framework/CommandLineParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public void ParserHasKnownDefaultArguments()
Assert.IsFalse(parser.SkipAutoImplementedProperties);
Assert.IsFalse(parser.RegExFilters);
Assert.IsFalse(parser.PrintVersion);
Assert.AreEqual(new TimeSpan(0, 0, 30), parser.ServiceStartTimeout);
}

[Test]
Expand Down