Skip to content

Commit bc97e5c

Browse files
author
Ilan
committed
Review changes
1 parent ec73870 commit bc97e5c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

framework/components/blockchain/anvil_zksync.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,22 @@ func newAnvilZksync(in *Input) (*Output, error) {
4545
defaultAnvilZksync(in)
4646
req := baseRequest(in)
4747

48-
tempDir, err := os.MkdirTemp(".", "anvil-zksync-dockercontext-")
48+
tempDir, err := os.MkdirTemp(".", "anvil-zksync-dockercontext")
4949
if err != nil {
5050
return nil, err
5151
}
5252

53+
defer func() {
54+
// delete the folder wether it was successful or not
55+
_ = os.RemoveAll(tempDir)
56+
}()
57+
5358
dockerfilePath := filepath.Join(tempDir, "anvilZksync.Dockerfile")
5459

5560
if err := os.WriteFile(dockerfilePath, []byte(dockerFile), 0600); err != nil {
5661
return nil, err
5762
}
63+
5864
req.FromDockerfile = testcontainers.FromDockerfile{
5965
Context: tempDir,
6066
Dockerfile: "anvilZksync.Dockerfile",
@@ -68,12 +74,9 @@ func newAnvilZksync(in *Input) (*Output, error) {
6874
" --chain-id " + in.ChainID +
6975
" --port " + in.Port}
7076

71-
framework.L.Info().Any("Cmd", strings.Join(req.Entrypoint, " ")).Msg("Creating anvil with command")
77+
framework.L.Info().Any("Cmd", strings.Join(req.Entrypoint, " ")).Msg("Creating anvil zkSync with command")
7278

7379
output, err := createGenericEvmContainer(in, req)
74-
// try to delete the file even if there is an error
75-
_ = os.RemoveAll(tempDir)
76-
7780
if err != nil {
7881
return nil, err
7982
}

0 commit comments

Comments
 (0)