(action, originalIsError, originalError)
| 928 | } |
| 929 | |
| 930 | function shutdownWithAction(action, originalIsError, originalError) { |
| 931 | if (shuttingDown === true) { |
| 932 | return; |
| 933 | } |
| 934 | shuttingDown = true; |
| 935 | |
| 936 | if (dest.state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) { |
| 937 | waitForWritesToFinish().then(doTheRest).catch(ignoreReason); |
| 938 | } |
| 939 | else { |
| 940 | doTheRest(); |
| 941 | } |
| 942 | |
| 943 | function doTheRest() { |
| 944 | action().then( |
| 945 | () => finalize(originalIsError, originalError), |
| 946 | newError => finalize(true, newError) |
| 947 | ); |
| 948 | } |
| 949 | } |
| 950 | |
| 951 | function shutdown(isError, error) { |
| 952 | if (shuttingDown === true) { |
no test coverage detected