AnswerDotAI / AnswerDotAI/fastcore

Exit code 1 when using a @call_parse CLI with a return

Open
#442 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
1.1k
Forks
295
Avg merge
1d 6h
Merged PRs (30d)
7

Description

Using fastcore 1.5.10 I have been noticing some of my Github workflows failing with "Process completed with exit code 1" and no other error messages.

After playing around it seems that @call_parse decorated functions which return something cause this behaviour. A minimal example:

```
@call_parse
def func1():
x = 1
return x

@call_parse
def func2():
x = 1
```

Now, at the command line:

```
> func1
> echo $?
1

> func2
> echo $?
0
```

That is, the first function fails while the second works fine. Is this intended? In my experience it can be useful to double up my CLI with general usage functions; currently I will need to use dedicated CLI functions which are not usable elsewhere in my code.

Thanks a lot in advance!

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the minimal func1 and func2 examples with fastcore 1.5.10 and inspect the @call_parse entry point. Compare the command-line exit behavior for functions that return a value versus those that do not; done means the intended return-value behavior is established and covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.