Patch by lukexi.
Patch by lukexi.

Fixing #8217 for the unix(-like) case.

oldmanmike/ghc,fmthoma/ghc,spacekitteh/smcghc,tjakway/ghcjvm,ezyang/ghc,TomMD/ghc,gridaphobe/ghc,ryantm/ghc,gcampax/ghc,wxwxwwxxx/ghc,snoyberg/ghc,forked-upstream-packages-for-ghcjs/ghc,ezyang/ghc,elieux/ghc,fmthoma/ghc,vTurbine/ghc,nathyong/microghc-ghc,elieux/ghc,olsner/ghc,olsner/ghc,fmthoma/ghc,mettekou/ghc,spacekitteh/smcghc,tjakway/ghcjvm,fmthoma/ghc,anton-dessiatov/ghc,sgillespie/ghc,nushio3/ghc,ml9951/ghc,ml9951/ghc,green-haskell/ghc,siddhanathan/ghc,vikraman/ghc,nushio3/ghc,olsner/ghc,tibbe/ghc,holzensp/ghc,fmthoma/ghc,wxwxwwxxx/ghc,shlevy/ghc,ghc-android/ghc,hferreiro/replay,gridaphobe/ghc,GaloisInc/halvm-ghc,ghc-android/ghc,ml9951/ghc,tibbe/ghc,GaloisInc/halvm-ghc,nkaretnikov/ghc,olsner/ghc,acowley/ghc,AlexanderPankiv/ghc,hferreiro/replay,urbanslug/ghc,TomMD/ghc,vikraman/ghc,AlexanderPankiv/ghc,frantisekfarka/ghc-dsi,mcschroeder/ghc,shlevy/ghc,vTurbine/ghc,hferreiro/replay,sgillespie/ghc,oldmanmike/ghc,lukexi/ghc-7.8-arm64,mettekou/ghc,siddhanathan/ghc,elieux/ghc,nkaretnikov/ghc,oldmanmike/ghc,mfine/ghc,urbanslug/ghc,snoyberg/ghc,tjakway/ghcjvm,ezyang/ghc,jstolarek/ghc,vikraman/ghc,mfine/ghc,vTurbine/ghc,tibbe/ghc,da-x/ghc,nushio3/ghc,sgillespie/ghc,mcschroeder/ghc,mettekou/ghc,anton-dessiatov/ghc,urbanslug/ghc,sdiehl/ghc,green-haskell/ghc,ekmett/ghc,urbanslug/ghc,TomMD/ghc,anton-dessiatov/ghc,lukexi/ghc,bitemyapp/ghc,ryantm/ghc,nathyong/microghc-ghc,oldmanmike/ghc,TomMD/ghc,snoyberg/ghc,mfine/ghc,sgillespie/ghc,vTurbine/ghc,oldmanmike/ghc,shlevy/ghc,TomMD/ghc,olsner/ghc,ml9951/ghc,forked-upstream-packages-for-ghcjs/ghc,gridaphobe/ghc,mfine/ghc,GaloisInc/halvm-ghc,christiaanb/ghc,AlexanderPankiv/ghc,shlevy/ghc,jstolarek/ghc,ezyang/ghc,sgillespie/ghc,TomMD/ghc,da-x/ghc,lukexi/ghc,lukexi/ghc,ghc-android/ghc,siddhanathan/ghc,urbanslug/ghc,elieux/ghc,ezyang/ghc,nathyong/microghc-ghc,nkaretnikov/ghc,da-x/ghc,forked-upstream-packages-for-ghcjs/ghc,ghc-android/ghc,vikraman/ghc,gcampax/ghc,acowley/ghc,mettekou/ghc,snoyberg/ghc,nkaretnikov/ghc,mettekou/ghc,vTurbine/ghc,gcampax/ghc,wxwxwwxxx/ghc,forked-upstream-packages-for-ghcjs/ghc,mfine/ghc,shlevy/ghc,da-x/ghc,frantisekfarka/ghc-dsi,fmthoma/ghc,lukexi/ghc,ekmett/ghc,nathyong/microghc-ghc,ekmett/ghc,acowley/ghc,nathyong/microghc-ghc,hferreiro/replay,sdiehl/ghc,nushio3/ghc,ekmett/ghc,vikraman/ghc,christiaanb/ghc,lukexi/ghc,elieux/ghc,lukexi/ghc-7.8-arm64,christiaanb/ghc,green-haskell/ghc,nathyong/microghc-ghc,mettekou/ghc,vikraman/ghc,ekmett/ghc,da-x/ghc,mfine/ghc,bitemyapp/ghc,vikraman/ghc,vTurbine/ghc,anton-dessiatov/ghc,acowley/ghc,mcschroeder/ghc,mcschroeder/ghc,olsner/ghc,wxwxwwxxx/ghc,gcampax/ghc,anton-dessiatov/ghc,vTurbine/ghc,hferreiro/replay,mcschroeder/ghc,nkaretnikov/ghc,nushio3/ghc,tibbe/ghc,sgillespie/ghc,spacekitteh/smcghc,oldmanmike/ghc,jstolarek/ghc,urbanslug/ghc,AlexanderPankiv/ghc,ryantm/ghc,AlexanderPankiv/ghc,hferreiro/replay,bitemyapp/ghc,tjakway/ghcjvm,snoyberg/ghc,acowley/ghc,siddhanathan/ghc,da-x/ghc,christiaanb/ghc,jstolarek/ghc,sdiehl/ghc,GaloisInc/halvm-ghc,lukexi/ghc-7.8-arm64,shlevy/ghc,sdiehl/ghc,mcschroeder/ghc,frantisekfarka/ghc-dsi,green-haskell/ghc,siddhanathan/ghc,da-x/ghc,green-haskell/ghc,nkaretnikov/ghc,christiaanb/ghc,mfine/ghc,sgillespie/ghc,nkaretnikov/ghc,elieux/ghc,wxwxwwxxx/ghc,ezyang/ghc,ryantm/ghc,ghc-android/ghc,wxwxwwxxx/ghc,tjakway/ghcjvm,GaloisInc/halvm-ghc,lukexi/ghc-7.8-arm64,tjakway/ghcjvm,gcampax/ghc,ryantm/ghc,AlexanderPankiv/ghc,tjakway/ghcjvm,ml9951/ghc,nathyong/microghc-ghc,TomMD/ghc,ghc-android/ghc,ghc-android/ghc,gcampax/ghc,gridaphobe/ghc,mcschroeder/ghc,acowley/ghc,forked-upstream-packages-for-ghcjs/ghc,holzensp/ghc,olsner/ghc,mettekou/ghc,siddhanathan/ghc,ezyang/ghc,urbanslug/ghc,nushio3/ghc,frantisekfarka/ghc-dsi,elieux/ghc,wxwxwwxxx/ghc,gridaphobe/ghc,GaloisInc/halvm-ghc,tibbe/ghc,ml9951/ghc,gcampax/ghc,spacekitteh/smcghc,holzensp/ghc,ml9951/ghc,christiaanb/ghc,acowley/ghc,ml9951/ghc,sdiehl/ghc,siddhanathan/ghc,hferreiro/replay,spacekitteh/smcghc,nushio3/ghc,jstolarek/ghc,holzensp/ghc,oldmanmike/ghc,sdiehl/ghc,forked-upstream-packages-for-ghcjs/ghc,frantisekfarka/ghc-dsi,sdiehl/ghc,gridaphobe/ghc,holzensp/ghc,lukexi/ghc-7.8-arm64,snoyberg/ghc,christiaanb/ghc,AlexanderPankiv/ghc,bitemyapp/ghc,anton-dessiatov/ghc,fmthoma/ghc,bitemyapp/ghc,GaloisInc/halvm-ghc,snoyberg/ghc,anton-dessiatov/ghc,forked-upstream-packages-for-ghcjs/ghc,shlevy/ghc,gridaphobe/ghc