Skip to content

Commit 7907935

Browse files
authored
babel: Close file before removing
1 parent 02d5ec1 commit 7907935

File tree

1 file changed

+4
-1
lines changed
  • resources/resource_transformers/babel

1 file changed

+4
-1
lines changed

resources/resource_transformers/babel/babel.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,10 @@ func (t *babelTransformation) Transform(ctx *resources.ResourceTransformationCtx
172172
cmdArgs = append(cmdArgs, hexec.WithStdout(stderr))
173173
cmdArgs = append(cmdArgs, hexec.WithEnviron(hugo.GetExecEnviron(t.rs.Cfg.BaseConfig().WorkingDir, t.rs.Cfg, t.rs.BaseFs.Assets.Fs)))
174174

175-
defer os.Remove(compileOutput.Name())
175+
defer func() {
176+
compileOutput.Close()
177+
os.Remove(compileOutput.Name())
178+
}()
176179

177180
// ARGA [--no-install babel --config-file /private/var/folders/_g/j3j21hts4fn7__h04w2x8gb40000gn/T/hugo-test-babel812882892/babel.config.js --source-maps --filename=js/main2.js --out-file=/var/folders/_g/j3j21hts4fn7__h04w2x8gb40000gn/T/compileOut-2237820197.js]
178181
// [--no-install babel --config-file /private/var/folders/_g/j3j21hts4fn7__h04w2x8gb40000gn/T/hugo-test-babel332846848/babel.config.js --filename=js/main.js --out-file=/var/folders/_g/j3j21hts4fn7__h04w2x8gb40000gn/T/compileOut-1451390834.js 0x10304ee60 0x10304ed60 0x10304f060]

0 commit comments

Comments
 (0)