This repository was archived by the owner on Nov 13, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +28
-6
lines changed
Expand file tree Collapse file tree 2 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -16,10 +16,19 @@ export default class GeneralStopCommand extends InstanceCommand {
1616
1717 instance . status ( Instance . STATUS_STOPPING ) ;
1818
19- if ( stopCommand . toLocaleLowerCase ( ) == "^c" ) {
20- instance . process . kill ( "SIGINT" ) ;
21- } else {
22- await instance . exec ( new SendCommand ( stopCommand ) ) ;
19+ const stopCommandList = stopCommand . split ( / ( \^ c | \^ C | \\ n | \\ N ) / g) ;
20+ for ( const stopCommandColumn of stopCommandList ) {
21+ if ( stopCommandColumn == "" ) {
22+ continue ;
23+ }
24+ if ( stopCommandColumn . toLocaleLowerCase ( ) == "\\n" ) {
25+ continue ;
26+ }
27+ if ( stopCommandColumn . toLocaleLowerCase ( ) == "^c" ) {
28+ instance . process . kill ( "SIGINT" ) ;
29+ } else {
30+ await instance . exec ( new SendCommand ( stopCommandColumn ) ) ;
31+ }
2332 }
2433
2534 instance . println ( "INFO" , $t ( "general_stop.execCmd" , { stopCommand } ) ) ;
Original file line number Diff line number Diff line change @@ -17,8 +17,21 @@ export default class PtyStopCommand extends InstanceCommand {
1717 instance . status ( Instance . STATUS_STOPPING ) ;
1818
1919 instance . println ( "INFO" , $t ( "pty_stop.execCmd" , { stopCommand : stopCommand } ) ) ;
20- if ( stopCommand . toLowerCase ( ) == "^c" ) stopCommand = "\x03" ;
21- await instance . exec ( new SendCommand ( stopCommand ) ) ;
20+
21+ const stopCommandList = stopCommand . split ( / ( \^ c | \^ C | \\ n | \\ N ) / g) ;
22+ for ( const stopCommandColumn of stopCommandList ) {
23+ if ( stopCommandColumn == "" ) {
24+ continue ;
25+ }
26+ if ( stopCommandColumn . toLocaleLowerCase ( ) == "\\n" ) {
27+ continue ;
28+ }
29+ if ( stopCommandColumn . toLocaleLowerCase ( ) == "^c" ) {
30+ await instance . exec ( new SendCommand ( "\x03" ) ) ;
31+ } else {
32+ await instance . exec ( new SendCommand ( stopCommandColumn ) ) ;
33+ }
34+ }
2235
2336 // If the instance is still in the stopped state after 10 minutes, restore the state
2437 const cacheStartCount = instance . startCount ;
You can’t perform that action at this time.
0 commit comments