diff options
Diffstat (limited to 'tests/service')
-rw-r--r-- | tests/service/testservice.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/service/testservice.c b/tests/service/testservice.c index 478dbc4..ddc0347 100644 --- a/tests/service/testservice.c +++ b/tests/service/testservice.c @@ -65,7 +65,14 @@ void __cdecl _tmain( int argc, TCHAR *argv[] ) { /* called as service, dispatch the main service thread */ if( argc < 2 ) { - (void)wolf_service_start( SERVICE_NAME, &service_main ); + wolf_error_t error; + + error = wolf_service_start( SERVICE_NAME, &service_main ); + if( error == WOLF_ERR_INVALID_STATE ) { + /* running in console */ + (void)wolf_service_start_console( SERVICE_NAME, &service_main, argc, argv ); + } + /* here we get when the service is stopping */ return; } @@ -79,7 +86,6 @@ void __cdecl _tmain( int argc, TCHAR *argv[] ) { printf( " /help show this help page\r\n" ); printf( " /install install the service\r\n" ); printf( " /remove remove the service\r\n" ); - printf( " /foreground run as console application\r\n" ); } else if( strcasecmp( argv[1], "/install" ) == 0 ) { wolf_service_params_t params; params.service_name = SERVICE_NAME; @@ -87,8 +93,6 @@ void __cdecl _tmain( int argc, TCHAR *argv[] ) { (void)wolf_service_install( params ); } else if( strcasecmp( argv[1], "/remove" ) == 0 ) { (void)wolf_service_remove( SERVICE_NAME ); - } else if( strcasecmp( argv[1], "/foreground" ) == 0 ) { - (void)wolf_service_start_console( SERVICE_NAME, &service_main, argc, argv ); } else { fprintf( stderr, "Illegal option '%s'\r\n", argv[1] ); } |