Tiltfile: run local command and get exit code
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 10.1k
- Forks
- 413
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 6
Description
A few times this week, I've written Tiltfile snippets for ppl that run a local command and check if that command succeeded or failed, e.g.:
def file_exists(f):
code = local('test -f {}; echo $?'.format(f))
# exit code 0 means `test` succeeded, i.e. file exists
return str(code).strip()=='0'
Notably, we do NOT want to stop Tiltfile execution if the command fails.
Might be nice to have a builtin for local_with_exit_code (or similar) that will do this for us, i.e. run the command and return its exit code (WITHOUT stopping Tiltfile execution on a failed command).
Open question: would we still want this func to return the command's stdout?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the existing Tiltfile local command entry point and its behavior when a command fails. Define how a local_with_exit_code-style builtin should expose the exit code without stopping Tiltfile execution, and resolve whether stdout is also returned; done means the requested failure handling and return value are covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100