@@ -16,12 +16,8 @@ namespace Microsoft.OpenApi.Hidi
16
16
static class Program
17
17
{
18
18
static async Task Main ( string [ ] args )
19
- {
20
- // subscribe to CancelKeyPress event to listen for termination requests from users through Ctrl+C or Ctrl+Break keys
21
- Console . CancelKeyPress += new ConsoleCancelEventHandler ( Console_CancelKeyPressEvent ) ;
22
-
23
- var rootCommand = new RootCommand ( ) {
24
- } ;
19
+ {
20
+ var rootCommand = new RootCommand ( ) { } ;
25
21
26
22
// command option parameters and aliases
27
23
var descriptionOption = new Option < string > ( "--openapi" , "Input OpenAPI description file path or URL" ) ;
@@ -121,36 +117,12 @@ static async Task Main(string[] args)
121
117
122
118
rootCommand . Add ( transformCommand ) ;
123
119
rootCommand . Add ( validateCommand ) ;
124
-
120
+
125
121
// Parse the incoming args and invoke the handler
126
122
await rootCommand . InvokeAsync ( args ) ;
127
123
128
124
//// Wait for logger to write messages to the console before exiting
129
125
await Task . Delay ( 10 ) ;
130
- }
131
-
132
- /// <summary>
133
- /// This event is raised when the user presses either of the two breaking key combinations: Ctrl+C or Ctrl+Break keys.
134
- /// </summary>
135
- /// <param name="sender"></param>
136
- /// <param name="eventArgs"></param>
137
- private static void Console_CancelKeyPressEvent ( object sender , ConsoleCancelEventArgs eventArgs )
138
- {
139
- if ( ( eventArgs . SpecialKey == ConsoleSpecialKey . ControlC ) || ( eventArgs . SpecialKey == ConsoleSpecialKey . ControlBreak ) )
140
- {
141
- Console . WriteLine ( "CTRL+C pressed, aborting current process..." ) ;
142
- Thread . Sleep ( 5000 ) ;
143
-
144
- if ( Process . GetCurrentProcess ( ) . HasExited )
145
- {
146
- Console . WriteLine ( "Process has already exited." ) ;
147
- }
148
- else
149
- {
150
- Console . WriteLine ( "Process has not exited, attempting to kill process..." ) ;
151
- Process . GetCurrentProcess ( ) . Kill ( ) ;
152
- }
153
- }
154
126
}
155
127
}
156
128
}
0 commit comments