diff options
author | Ayke van Laethem <[email protected]> | 2022-11-05 18:09:11 +0100 |
---|---|---|
committer | Ron Evans <[email protected]> | 2022-11-06 14:06:58 +0100 |
commit | 666ead3996603afe26bffd122efb95ac5cc34d66 (patch) | |
tree | 71e76305a5169954e7336e8bc05ed5a227be6c09 /main.go | |
parent | df888acd5eff0eb5a70ef87ba083f0f15737d120 (diff) | |
download | tinygo-666ead3996603afe26bffd122efb95ac5cc34d66.tar.gz tinygo-666ead3996603afe26bffd122efb95ac5cc34d66.zip |
main: fix -work flag
I broke this flag in f866d5cc38319b1abcfd2e7302b2b8ed7d89cdad. This
commit fixes it.
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -160,7 +160,9 @@ func Build(pkgName, outpath string, options *compileopts.Options) error { if err != nil { return err } - defer os.RemoveAll(tmpdir) + if !options.Work { + defer os.RemoveAll(tmpdir) + } // Do the build. result, err := builder.Build(pkgName, outpath, tmpdir, config) @@ -405,7 +407,9 @@ func Flash(pkgName, port string, options *compileopts.Options) error { if err != nil { return err } - defer os.RemoveAll(tmpdir) + if !options.Work { + defer os.RemoveAll(tmpdir) + } // Build the binary. result, err := builder.Build(pkgName, fileExt, tmpdir, config) @@ -552,7 +556,9 @@ func Debug(debugger, pkgName string, ocdOutput bool, options *compileopts.Option if err != nil { return err } - defer os.RemoveAll(tmpdir) + if !options.Work { + defer os.RemoveAll(tmpdir) + } // Build the binary to debug. format, fileExt := config.EmulatorFormat() @@ -824,7 +830,9 @@ func buildAndRun(pkgName string, config *compileopts.Config, stdout io.Writer, c if err != nil { return err } - defer os.RemoveAll(tmpdir) + if !config.Options.Work { + defer os.RemoveAll(tmpdir) + } // Build the binary to be run. format, fileExt := config.EmulatorFormat() |