sjbarag / brs

An interpreter for the BrightScript language that runs on non-Roku platforms.
MIT License
113 stars 43 forks source link

Set exit status programmatically #150

Open sjbarag opened 5 years ago

sjbarag commented 5 years ago

This is a pure extension to the Reference BrightScript Implementation. It'd be neat to have some ability to set the exit status for the brs command from within a BrightScript function. Perhaps this looks something like Node's process.exitCode? It'll be important to avoid naming conflicts since there's no easy way to namespace things.

Perhaps a common namespace for all the extensions this implementation provides?

sjbarag commented 5 years ago

As far as why this is useful:

Consider a testing tool that runs as part of a Jenkins/Travis/Circle/AzurePipelines/GitLabCI/any-other-CI system. Without the ability to programmatically set an exit code, that framework is stuck forcing a runtime error with something silly like invalid() or print 1/0. It works, but it's pretty non-obvious from a maintenance perspective. Having some clear way to set an exit status would make life much easier!