Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add skip_run so build only works on windows #494

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,9 @@ Should use `\` to escape the `' in the bin. related issue: [#305](https://github

### Question: how to do hot compile only and do not run anything?

[#365](https://github.com/cosmtrek/air/issues/365)

```toml
[build]
cmd = "/usr/bin/true"
skip_run = true
```

## Development
Expand Down
2 changes: 2 additions & 0 deletions air_example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ rerun = false
rerun_delay = 500
# Add additional arguments when running binary (bin/full_bin). Will run './tmp/main hello world'.
args_bin = ["hello", "world"]
# Skips the run step so it's only builds
skip_run = false

[log]
# Show log time
Expand Down
1 change: 1 addition & 0 deletions runner/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type cfgBuild struct {
KillDelay time.Duration `toml:"kill_delay"`
Rerun bool `toml:"rerun"`
RerunDelay int `toml:"rerun_delay"`
SkipRun bool `toml:"skip_run"`
regexCompiled []*regexp.Regexp
}

Expand Down
8 changes: 6 additions & 2 deletions runner/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,12 @@ func (e *Engine) buildRun() {
return
default:
}
if err = e.runBin(); err != nil {
e.runnerLog("failed to run, error: %s", err.Error())
if e.config.Build.SkipRun {
e.runnerLog("skipping run step")
} else {
if err = e.runBin(); err != nil {
e.runnerLog("failed to run, error: %s", err.Error())
}
}
}

Expand Down