tilt-dev / tilt-dev/tilt

Tiltfile: run local command and get exit code

Open
#2,183 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.