File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -301,9 +301,19 @@ if (specified["in-situ"]) {
301301 process . stdin . setEncoding ( "utf8" ) ;
302302 process . stdin . once ( "data" , function ( ) {
303303 clearTimeout ( timerId ) ;
304- } ) . on ( "data" , function ( chunk ) {
304+ } ) . on ( "data" , process . stdin . isTTY ? function ( chunk ) {
305+ // emulate console input termination via Ctrl+D / Ctrl+Z
306+ var match = / [ \x04 \x1a ] \r ? \n ? $ / . exec ( chunk ) ;
307+ if ( match ) {
308+ chunks . push ( chunk . slice ( 0 , - match [ 0 ] . length ) ) ;
309+ process . stdin . pause ( ) ;
310+ process . stdin . emit ( "end" ) ;
311+ } else {
312+ chunks . push ( chunk ) ;
313+ }
314+ } : function ( chunk ) {
305315 chunks . push ( chunk ) ;
306- } ) . on ( "end" , function ( ) {
316+ } ) . once ( "end" , function ( ) {
307317 files = { STDIN : chunks . join ( "" ) } ;
308318 run ( ) ;
309319 } ) ;
Original file line number Diff line number Diff line change 66} catch ( e ) {
77 // ensure output buffers are flushed before process termination
88 var exit = process . exit ;
9- process . exit = function ( ) {
9+ if ( "bufferSize" in process . stdout ) process . exit = function ( ) {
1010 var args = [ ] . slice . call ( arguments ) ;
1111 process . once ( "uncaughtException" , function ( ) {
1212 ( function callback ( ) {
You can’t perform that action at this time.
0 commit comments