@@ -814,32 +814,6 @@ function restoreWritable(name) {
814
814
delete process [ name ] . writeTimes ;
815
815
}
816
816
817
- function onResolvedOrRejected ( promise , callback ) {
818
- return promise . then ( ( result ) => {
819
- callback ( ) ;
820
- return result ;
821
- } , ( error ) => {
822
- callback ( ) ;
823
- throw error ;
824
- } ) ;
825
- }
826
-
827
- function timeoutPromise ( error , timeoutMs ) {
828
- let clearCallback = null ;
829
- let done = false ;
830
- const promise = onResolvedOrRejected ( new Promise ( ( resolve , reject ) => {
831
- const timeout = setTimeout ( ( ) => reject ( error ) , timeoutMs ) ;
832
- clearCallback = ( ) => {
833
- if ( done )
834
- return ;
835
- clearTimeout ( timeout ) ;
836
- resolve ( ) ;
837
- } ;
838
- } ) , ( ) => done = true ) ;
839
- promise . clear = clearCallback ;
840
- return promise ;
841
- }
842
-
843
817
exports . hijackStdout = hijackStdWritable . bind ( null , 'stdout' ) ;
844
818
exports . hijackStderr = hijackStdWritable . bind ( null , 'stderr' ) ;
845
819
exports . restoreStdout = restoreWritable . bind ( null , 'stdout' ) ;
@@ -853,19 +827,3 @@ exports.firstInvalidFD = function firstInvalidFD() {
853
827
} catch ( e ) { }
854
828
return fd ;
855
829
} ;
856
-
857
- exports . fires = function fires ( promise , error , timeoutMs ) {
858
- if ( ! timeoutMs && util . isNumber ( error ) ) {
859
- timeoutMs = error ;
860
- error = null ;
861
- }
862
- if ( ! error )
863
- error = 'timeout' ;
864
- if ( ! timeoutMs )
865
- timeoutMs = 100 ;
866
- const timeout = timeoutPromise ( error , timeoutMs ) ;
867
- return Promise . race ( [
868
- onResolvedOrRejected ( promise , ( ) => timeout . clear ( ) ) ,
869
- timeout
870
- ] ) ;
871
- } ;
0 commit comments