Exit Code Generator
Tool to sleep for a given amount of milliseconds and then return a given exit code.
This is a small Windows command line utility to sleep for a given amount of milliseconds and then return a given exit code.
It is intended as a mockup for testing external application calls.
E.g. I'm using it in testing an application of mine that calls an external command line virus scanner, that takes some time to run and returns different exit codes depending on whether a virus was detected or not. Instead of specifying the actual virus scanner on our test machines, I simply call the
exitcode-generator.exe with different parameters.
exitcode-generator.exe [--exitcode=<code>] [--sleep=<milliseconds>] [--log=<true|false>] [--keeplogfiles=<true|false>] [--quiet=<true|false>]
(Multi-line for illustration purposes only; call as a single line in real life).
Command line arguments
Optional. Specify an integer exit code, positive or negative or zero to return from the application. If none is specified, zero is returned.
Optional. Specify a positive amount of milliseconds to sleep before exiting. If none is specified, the application returns immediately.
Optional. Specify whether to log to a file at all. If not specified, the default value is false.
Optional. Specify whether to clear any existing log file upon program start. If not specified, the default value is true. Useful for calling the program multiple times and having one large cumulated log file.
Optional. Specify whether to output anything to the console at all. If not specified, the default value is false, meaning it does output text.
Immediately return exit code -2:
Wait for 2 seconds and then return exit code 5:
exitcode-generator.exe --sleep=2000 --exitcode=5
Wait for 3.5 seconds and then return exit code 0: