Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

result of "sls offline start --exec 'exit 1'" doesn't return 1 #727

Closed
fffan64 opened this issue Jul 3, 2019 · 2 comments
Closed

result of "sls offline start --exec 'exit 1'" doesn't return 1 #727

fffan64 opened this issue Jul 3, 2019 · 2 comments

Comments

@fffan64
Copy link

fffan64 commented Jul 3, 2019

With serverless-offline 5.5.1:

foo@bar:~$ sls offline start --exec 'exit 1'
... serverless logs starting ...
Serverless: Halting offline server
foo@bar:~$ echo $?
0

With serverless-offline 3.16.0:

foo@bar:~$ sls offline start --exec 'exit 1'
... serverless logs starting ...
Serverless: Halting offline server
foo@bar:~$ echo $?
1

The --exec command doesn't care about the return code in recent version.

This is problematic if you use --exec to run your tests, as the exit code will always be 0 (no problem), and thus your pipeline will consider all tests pass correctly.

@fffan64
Copy link
Author

fffan64 commented Jul 3, 2019

look like i don't need start anymore in the command with --exec

After removing it, everything worked as expected

@dherault dherault closed this as completed Jul 3, 2019
@sime
Copy link

sime commented Jul 31, 2019

Had this problem internally and I wanted to narrow down to the version that was causing this, though now I'm failing to reproduce.

$ sls create -t aws-nodejs -p slsoffline
$ cd slsoffline
$ yarn add serverless-offline@5.5.1
$ vim serverless.yml # (add serverless-offline as a plugin)
$ sls offline start --exec 'exit 1'
$ echo $?

Output of the last two commands.

$ sls offline --exec 'exit 1'
Serverless: Starting Offline: dev/us-east-1.

Serverless: Routes for hello:
Serverless: POST /{apiVersion}/functions/slsoffline-dev-hello/invocations

Serverless: Offline listening on http://localhost:3000
Serverless: Enter "rp" to replay the last request
Serverless: Offline executing script [exit 1]
Serverless: exec stdout: []
Serverless: exec stderr: []
Serverless: Offline error executing script [Error: Command failed: exit 1
]
Serverless: Halting offline server
$ echo $?
1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants