Skip to content

Exit Codes; $RUNFILE; $RUNFILE_ROOTS - v0.8.0

Compare
Choose a tag to compare
@TekWizely TekWizely released this 11 Dec 08:13
· 30 commits to master since this release
0061dfd

What's Changed

  • run: Plumb the exit code of a command back to run by @rburchell in #35
  • exec: Provide a way to cleanup the temporary dir by @rburchell in #37
  • run: Show a better error on duplicate command by @rburchell in #38
  • feature: Adds support for RUNFILE env variable by @TekWizely in #40
  • feat(find runfile): Adds support for $RUNFILE_ROOTS path variable by @TekWizely in #41
  • refactor: Simplify messaging, remove calls to os.Exit and log.Fatal by @TekWizely in #42

Capture Command Exit Code

Runfile

exit:
	exit ${1:-0}

usage

run exit; echo $?
0

run exit 1; echo $?
1

run exit 127; echo $?
127

$RUNFILE Environment Variable

You can specify a runfile using the $RUNFILE environment variable:

$ export RUNFILE="/path/to/my/Runfile"

$ run <command>

For some other interesting uses of $RUNFILE, see:

NOTE: When specifying a runfile, the file does not have to be named "Runfile".

$RUNFILE_ROOTS Path Variable

You can instruct run to look up the directory path in search of a runfile.

You do this using the $RUNFILE_ROOTS path variable.

  • $RUNFILE_ROOTS is treated as a list of path entries (using standard os path separator)
  • Behaves largely similar to GIT_CEILING_DIRECTORIES
  • If $PWD is a child of a root entry, run walks-up looking for Runfile
  • Roots themselves are generally treated as exclusive (ie not checked)
  • $HOME, if a configured root, is treated as inclusive (ie it is checked)

general usage

export RUNFILE_ROOTS="${HOME}"  # Will walk up to $HOME (inclusively)

most permissive

export RUNFILE_ROOTS="/"  # Will walk up to / (exclusively)

NOTE: $HOME is given special treatment to support the case where a project is given its own user account and lives in the home folder of that user.

For the case of creating globally available tasks, see the Special Modes section.

New Contributors

Full Changelog: v0.7.2...v0.8.0