mirror of https://github.com/winsw/winsw
Remove test command
parent
3af523fe1c
commit
4b00bba644
|
@ -93,7 +93,6 @@ Your renamed *WinSW.exe* binary also accepts the following commands:
|
||||||
| [stop](docs/cli-commands.md#stop-command) | Stops the service. |
|
| [stop](docs/cli-commands.md#stop-command) | Stops the service. |
|
||||||
| [restart](docs/cli-commands.md#restart-command) | Stops and then starts the service. |
|
| [restart](docs/cli-commands.md#restart-command) | Stops and then starts the service. |
|
||||||
| [status](docs/cli-commands.md#status-command) | Checks the status of the service. |
|
| [status](docs/cli-commands.md#status-command) | Checks the status of the service. |
|
||||||
| [test](docs/cli-commands.md#test-command) | Checks if the service can be started and then stopped without installation. |
|
|
||||||
| [refresh](docs/cli-commands.md#refresh-command) | Refreshes the service properties without reinstallation. |
|
| [refresh](docs/cli-commands.md#refresh-command) | Refreshes the service properties without reinstallation. |
|
||||||
| [customize](docs/cli-commands.md#customize-command) | Customizes the wrapper executable. |
|
| [customize](docs/cli-commands.md#customize-command) | Customizes the wrapper executable. |
|
||||||
| dev | Experimental commands. |
|
| dev | Experimental commands. |
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
- [stop](#stop-command)
|
- [stop](#stop-command)
|
||||||
- [restart](#restart-command)
|
- [restart](#restart-command)
|
||||||
- [status](#status-command)
|
- [status](#status-command)
|
||||||
- [test](#test-command)
|
|
||||||
- [refresh](#refresh-command)
|
- [refresh](#refresh-command)
|
||||||
- [customize](#customize-command)
|
- [customize](#customize-command)
|
||||||
|
|
||||||
|
@ -164,39 +163,6 @@ winsw status [<path-to-config>]
|
||||||
The path to the configuration file.
|
The path to the configuration file.
|
||||||
If a file isn't specified, WinSW searches the executable directory for a *.xml* file with the same file name without the extension.
|
If a file isn't specified, WinSW searches the executable directory for a *.xml* file with the same file name without the extension.
|
||||||
|
|
||||||
## `test` command
|
|
||||||
|
|
||||||
Checks if the service can be started and then stopped without installation.
|
|
||||||
|
|
||||||
### Usage
|
|
||||||
|
|
||||||
```console
|
|
||||||
winsw test [<path-to-config>] [--no-elevate] [--timeout <timeout>] [--no-break]
|
|
||||||
```
|
|
||||||
|
|
||||||
### Arguments
|
|
||||||
|
|
||||||
`path-to-config`
|
|
||||||
|
|
||||||
The path to the configuration file.
|
|
||||||
If a file isn't specified, WinSW searches the executable directory for a *.xml* file with the same file name without the extension.
|
|
||||||
|
|
||||||
### Options
|
|
||||||
|
|
||||||
- `--no-elevate`
|
|
||||||
|
|
||||||
Doesn't automatically trigger a UAC prompt.
|
|
||||||
|
|
||||||
- `--timeout <timeout>`
|
|
||||||
|
|
||||||
Specifies the number of seconds to wait before the service is stopped.
|
|
||||||
If not specified or -1 is specified, WinSW waits for a keystroke indefinitely.
|
|
||||||
|
|
||||||
- `--no-break`
|
|
||||||
|
|
||||||
Ignores keystrokes.
|
|
||||||
If specified, WinSW waits for Ctrl+C.
|
|
||||||
|
|
||||||
## `refresh` command
|
## `refresh` command
|
||||||
|
|
||||||
Refreshes the service properties without reinstallation.
|
Refreshes the service properties without reinstallation.
|
||||||
|
|
|
@ -248,20 +248,6 @@ namespace WinSW
|
||||||
root.Add(status);
|
root.Add(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
var test = new Command("test", "Checks if the service can be started and then stopped without installation.")
|
|
||||||
{
|
|
||||||
Handler = CommandHandler.Create<string?, bool, bool>(Test),
|
|
||||||
};
|
|
||||||
|
|
||||||
test.Add(config);
|
|
||||||
test.Add(noElevate);
|
|
||||||
|
|
||||||
test.Add(new Option("--no-break", "Ignores keystrokes."));
|
|
||||||
|
|
||||||
root.Add(test);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
var refresh = new Command("refresh", "Refreshes the service properties without reinstallation.")
|
var refresh = new Command("refresh", "Refreshes the service properties without reinstallation.")
|
||||||
{
|
{
|
||||||
|
@ -809,50 +795,6 @@ namespace WinSW
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test(string? pathToConfig, bool noElevate, bool noBreak)
|
|
||||||
{
|
|
||||||
var config = LoadConfigAndInitLoggers(pathToConfig, true);
|
|
||||||
|
|
||||||
if (!elevated)
|
|
||||||
{
|
|
||||||
Elevate(noElevate);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
AutoRefresh(config);
|
|
||||||
|
|
||||||
using var wsvc = new WrapperService(config);
|
|
||||||
wsvc.RaiseOnStart(args);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!noBreak)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Press any key to stop the service...");
|
|
||||||
_ = Console.ReadKey();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
using var evt = new ManualResetEvent(false);
|
|
||||||
|
|
||||||
Console.WriteLine("Press Ctrl+C to stop the service...");
|
|
||||||
Console.CancelKeyPress += CancelKeyPress;
|
|
||||||
|
|
||||||
_ = evt.WaitOne();
|
|
||||||
Console.CancelKeyPress -= CancelKeyPress;
|
|
||||||
|
|
||||||
void CancelKeyPress(object? sender, ConsoleCancelEventArgs e)
|
|
||||||
{
|
|
||||||
e.Cancel = true;
|
|
||||||
evt.Set();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
wsvc.RaiseOnStop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Refresh(string? pathToConfig, bool noElevate)
|
void Refresh(string? pathToConfig, bool noElevate)
|
||||||
{
|
{
|
||||||
var config = LoadConfigAndInitLoggers(pathToConfig, true);
|
var config = LoadConfigAndInitLoggers(pathToConfig, true);
|
||||||
|
|
Loading…
Reference in New Issue