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

Fix truncated results #5107

Merged
merged 1 commit into from
Aug 19, 2020
Merged

Conversation

bboure
Copy link
Contributor

@bboure bboure commented Aug 17, 2020

Issue #, if available:
#4439

Description of changes:
As per NodeJs doc:

Calling process.exit() will force the process to exit as quickly as possible even if there are still asynchronous operations pending that have not yet completed fully, including I/O operations to process.stdout and process.stderr.

This causes sometimes the output to be truncated, making JSON.parse fail, when the output has not been completely processed.

I changed process.exit for https://github.com/cowboy/node-exit which ensures that stdout is fully drained.

After testing it, this solution seems to work.

Credits: This comment helped:
sindresorhus/execa#130 (comment)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov
Copy link

codecov bot commented Aug 17, 2020

Codecov Report

Merging #5107 into master will increase coverage by 0.00%.
The diff coverage is 50.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master    #5107    +/-   ##
========================================
  Coverage   61.37%   61.38%            
========================================
  Files         374      374            
  Lines       16556    16557     +1     
  Branches     3288     3108   -180     
========================================
+ Hits        10162    10163     +1     
- Misses       5885     5904    +19     
+ Partials      509      490    -19     
Impacted Files Coverage Δ
...ejs-function-runtime-provider/src/utils/execute.ts 74.54% <50.00%> (+0.47%) ⬆️
packages/amplify-util-mock/src/api/api.ts 0.00% <0.00%> (ø)
packages/graphql-mapping-template/src/print.ts 34.65% <0.00%> (ø)
packages/amplify-util-mock/src/storage/storage.ts 0.00% <0.00%> (ø)
...ges/amplify-util-mock/src/CFNParser/stack/index.ts 0.00% <0.00%> (ø)
...es/amplify-util-mock/src/api/resolver-overrides.ts 0.00% <0.00%> (ø)
...es/graphql-transformer-core/src/stripDirectives.ts 35.29% <0.00%> (ø)
.../amplify-util-mock/src/utils/lambda/loadMinimal.ts 0.00% <0.00%> (ø)
...graphql-transformer-core/src/TransformerContext.ts 26.10% <0.00%> (ø)
...mplify-appsync-simulator/src/resolvers/function.ts 15.38% <0.00%> (ø)
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1f37437...ceeec13. Read the comment docs.

Copy link
Contributor

@edwardfoyle edwardfoyle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for another contribution @bboure!

@edwardfoyle edwardfoyle merged commit 8f2607c into aws-amplify:master Aug 19, 2020
sebastiancrossa pushed a commit to MLH-Fellowship/amplify-cli that referenced this pull request Aug 25, 2020
@github-actions
Copy link

This pull request has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants