File tree Expand file tree Collapse file tree 1 file changed +8
-13
lines changed
packages/jest-changed-files/src Expand file tree Collapse file tree 1 file changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -57,22 +57,17 @@ const adapter: SCMAdapter = {
57
57
getRoot : async cwd => {
58
58
try {
59
59
const subprocess = execa ( 'sl' , [ 'root' ] , { cwd, env} ) ;
60
- if ( subprocess . stdout == null ) {
61
- return null ;
62
- }
63
60
64
61
// Check if we're calling sl (steam locomotive) instead of sl (sapling)
65
62
// by looking for the escape character in the first chunk of data.
66
- let firstChunk = true ;
67
- subprocess . stdout . on ( 'data' , data => {
68
- if ( ! firstChunk ) {
69
- return ;
70
- }
71
- if ( data . toString ( ) . codePointAt ( 0 ) === 27 ) {
72
- subprocess . cancel ( ) ;
73
- }
74
- firstChunk = false ;
75
- } ) ;
63
+ if ( subprocess . stdout ) {
64
+ subprocess . stdout . once ( 'data' , ( data : Buffer | string ) => {
65
+ data = Buffer . isBuffer ( data ) ? data . toString ( ) : data ;
66
+ if ( data . codePointAt ( 0 ) === 27 ) {
67
+ subprocess . cancel ( ) ;
68
+ }
69
+ } ) ;
70
+ }
76
71
77
72
const result = await subprocess ;
78
73
if ( result . killed ) {
You can’t perform that action at this time.
0 commit comments