# RFC Mentoring Opportunity: Permit \`?\` in \`main()\`

**URL:** <https://internals.rust-lang.org/t/rfc-mentoring-opportunity-permit-in-main/4600>\
**Category:** Uncategorized\
**Created:** [January 12, 2017, 2:51pm UTC](https://internals.rust-lang.org/t/rfc-mentoring-opportunity-permit-in-main/4600 "2017-01-12T14:51:35Z")\
**Posts on this page:** 1\
**Showing post:** 57

<div class="post-metadata">

**Author:** ![zackw](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/zackw/32/2071_2.png) [@zackw](https://internals.rust-lang.org/u/zackw)\
**Post date:** [January 20, 2017, 12:56am UTC](https://internals.rust-lang.org/t/rfc-mentoring-opportunity-permit-in-main/4600/57 "2017-01-20T00:56:53Z")

</div>

Right now, to write Unix CLI utilities in Rust, you wind up doing something like this:

```rust
fn inner_main() -> Result<(), HLError> {
    let args = parse_cmdline()?;
    // all the real work here
}

fn main() {
    process::exit(match inner_main() {
        Ok(_) => 0,
        Err(ref e) => {
            writeln!(io::stderr(), "{}", e).unwrap();
            1
        }
    });
}

```

So I like the `fn main () -> something_Result_ish` proposal, because it basically paves this cowpath.

However. It is very important for this use case that returning an `Err` from `main` does _not_ trigger a panic. It normally would not represent a _bug_, and in some cases, it needs to produce _no output_ other than the exit code –

```rust
$ grep -q root /etc/passwd ; echo $?
0
$ grep -q notthere /etc/passwd ; echo $?
1
$ grep -q notthere /etc/shadow ; echo $?
grep: /etc/shadow: permission denied
2

```

---

_[View the full topic](https://internals.rust-lang.org/t/rfc-mentoring-opportunity-permit-in-main/4600)._
