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

Fixed bug on CLI output IONTEXT to file #479

Merged
merged 4 commits into from
Nov 29, 2021
Merged

Fixed bug on CLI output IONTEXT to file #479

merged 4 commits into from
Nov 29, 2021

Conversation

lziq
Copy link
Contributor

@lziq lziq commented Nov 23, 2021

Issue #473

Problem Description

As show in https://github.com/partiql/partiql-lang-kotlin/blob/main/cli/src/org/partiql/cli/Cli.kt#L52-53, the use block in L52 invokes close() function on output. In case of FileOutputStream, it indeed closes the output stream. Thus, the write() function in L53 throws an exception.

Description of changes:

  1. Move L53 into the use block.
  2. Create a test case to cover file output.

@lziq lziq self-assigned this Nov 23, 2021
@lziq lziq linked an issue Nov 23, 2021 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Nov 23, 2021

Codecov Report

Merging #479 (4ff861e) into main (36e20d1) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##               main     #479   +/-   ##
=========================================
  Coverage     82.38%   82.38%           
  Complexity     1406     1406           
=========================================
  Files           171      171           
  Lines         10816    10817    +1     
  Branches       1781     1781           
=========================================
+ Hits           8911     8912    +1     
  Misses         1361     1361           
  Partials        544      544           
Flag Coverage Δ
CLI 19.33% <100.00%> (+0.26%) ⬆️
EXAMPLES 74.85% <ø> (ø)
LANG 84.85% <ø> (ø)
PTS ∅ <ø> (∅)
TEST_SCRIPT 79.68% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cli/src/org/partiql/cli/Cli.kt 80.00% <100.00%> (+1.05%) ⬆️

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 36e20d1...4ff861e. Read the comment docs.

Copy link
Contributor

@abhikuhikar abhikuhikar left a comment

Choose a reason for hiding this comment

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

Change looks reasonable to me. However, after executing partiql -q "1" --output-format ION_TEXT -o temp.ion, it still waits to read from stdin but does not throw a stream closed error after providing input to stdin as it used to. However, I believe this should not be the case. The command should not wait for the input from stdin.

@lziq
Copy link
Contributor Author

lziq commented Nov 24, 2021

Change looks reasonable to me. However, after executing partiql -q "1" --output-format ION_TEXT -o temp.ion, it still waits to read from stdin but does not throw a stream closed error after providing input to stdin as it used to. However, I believe this should not be the case. The command should not wait for the input from stdin.

I think this issue is resolved in another PR, #478

abhikuhikar
abhikuhikar previously approved these changes Nov 29, 2021
@lziq lziq merged commit 3e3d8fd into main Nov 29, 2021
@lziq lziq deleted the CLI-output-IONTEXT branch November 29, 2021 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cli bug: Stream closed when outputting ion text
3 participants