1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-02 10:47:32 +03:00

Don't write log messages to stdout (#3159)

The "Cloning (...)" message was written to stdout which messed up
markdown generation.
This commit is contained in:
Łukasz Czajka 2024-11-11 15:31:37 +01:00 committed by GitHub
parent fc0d5a3d88
commit 76af2124b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 62 additions and 26 deletions

View File

@ -12,10 +12,10 @@ runLogIO ::
Sem (Log ': r) a -> Sem (Log ': r) a ->
Sem r a Sem r a
runLogIO sem = do runLogIO sem = do
liftIO (hSetBuffering stdout LineBuffering) liftIO (hSetBuffering stderr LineBuffering)
interpret interpret
( \case ( \case
Log txt -> putStrLn txt Log txt -> hPutStrLn stderr txt
) )
sem sem

View File

@ -63,6 +63,8 @@ tests:
./HelloWorld ./HelloWorld
stdout: stdout:
contains: Hello from dep contains: Hello from dep
stderr:
contains: ""
exit-status: 0 exit-status: 0
- name: git-dependencies-success-then-offline - name: git-dependencies-success-then-offline
@ -131,6 +133,8 @@ tests:
./HelloWorld ./HelloWorld
stdout: stdout:
contains: Hello from dep contains: Hello from dep
stderr:
contains: ""
exit-status: 0 exit-status: 0
- name: git-dependencies-fetch-new-commits - name: git-dependencies-fetch-new-commits
@ -228,6 +232,8 @@ tests:
./HelloWorld ./HelloWorld
stdout: stdout:
contains: This is from the second commit contains: This is from the second commit
stderr:
contains: ""
exit-status: 0 exit-status: 0
- name: git-dependencies-lockfile - name: git-dependencies-lockfile
@ -374,6 +380,8 @@ tests:
./HelloWorld ./HelloWorld
stdout: stdout:
contains: "Hello from dep1\nHello from dep2" contains: "Hello from dep1\nHello from dep2"
stderr:
contains: ""
exit-status: 0 exit-status: 0
- name: git-dependencies-uses-generated-lockfile - name: git-dependencies-uses-generated-lockfile
@ -454,6 +462,8 @@ tests:
./HelloWorld ./HelloWorld
stdout: stdout:
contains: Hello from dep contains: Hello from dep
stderr:
contains: ""
exit-status: 0 exit-status: 0
- name: git-dependencies-uses-generated-lockfile-update - name: git-dependencies-uses-generated-lockfile-update
@ -552,6 +562,8 @@ tests:
./HelloWorld ./HelloWorld
stdout: stdout:
contains: Hello from commit 2 contains: Hello from commit 2
stderr:
contains: ""
exit-status: 0 exit-status: 0
- name: git-dependencies-nested-lockfile - name: git-dependencies-nested-lockfile
@ -670,6 +682,8 @@ tests:
./HelloWorld ./HelloWorld
stdout: stdout:
contains: "Hello from dep1\nHello from dep2" contains: "Hello from dep1\nHello from dep2"
stderr:
contains: ""
exit-status: 0 exit-status: 0
- name: git-dependencies-update-ref-offline - name: git-dependencies-update-ref-offline
@ -770,6 +784,8 @@ tests:
./HelloWorld ./HelloWorld
stdout: stdout:
contains: This is from the second commit contains: This is from the second commit
stderr:
contains: ""
exit-status: 0 exit-status: 0
- name: git-dependencies-invalid-ref - name: git-dependencies-invalid-ref
@ -826,10 +842,10 @@ tests:
# compile project # compile project
juvix --log-level error compile native HelloWorld.juvix juvix --log-level error compile native HelloWorld.juvix
stdout:
contains: ""
stderr: stderr:
contains: invalid-ref contains: invalid-ref
stdout:
contains: Cloning
exit-status: 1 exit-status: 1
- name: git-dependencies-invalid-url - name: git-dependencies-invalid-url
@ -871,10 +887,10 @@ tests:
# compile project # compile project
juvix --log-level error compile native HelloWorld.juvix juvix --log-level error compile native HelloWorld.juvix
stdout:
contains: ""
stderr: stderr:
contains: Error contains: Error
stdout:
contains: Cloning
exit-status: 1 exit-status: 1
- name: git-dependencies-offline - name: git-dependencies-offline
@ -992,10 +1008,10 @@ tests:
# compile project # compile project
juvix --log-level error compile native HelloWorld.juvix juvix --log-level error compile native HelloWorld.juvix
stdout:
contains: ""
stderr: stderr:
contains: juvix clean contains: juvix clean
stdout:
contains: Cloning
exit-status: 1 exit-status: 1
- name: git-dependencies-duplicate-names - name: git-dependencies-duplicate-names
@ -1106,7 +1122,8 @@ tests:
# compile project # compile project
juvix --log-level error compile native HelloWorld.juvix juvix --log-level error compile native HelloWorld.juvix
stderr: ""
stdout: stdout:
contains: ""
stderr:
contains: Cloning contains: Cloning
exit-status: 0 exit-status: 0

View File

@ -61,6 +61,8 @@ tests:
./HelloWorld ./HelloWorld
stdout: stdout:
contains: Hello from dep contains: Hello from dep
stderr:
contains: ""
exit-status: 0 exit-status: 0
- name: git-dependencies-success-then-offline - name: git-dependencies-success-then-offline
@ -127,6 +129,8 @@ tests:
./HelloWorld ./HelloWorld
stdout: stdout:
contains: Hello from dep contains: Hello from dep
stderr:
contains: ""
exit-status: 0 exit-status: 0
- name: git-dependencies-fetch-new-commits - name: git-dependencies-fetch-new-commits
@ -219,6 +223,8 @@ tests:
./HelloWorld ./HelloWorld
stdout: stdout:
contains: This is from the second commit contains: This is from the second commit
stderr:
contains: ""
exit-status: 0 exit-status: 0
- name: git-dependencies-lockfile - name: git-dependencies-lockfile
@ -359,6 +365,8 @@ tests:
./HelloWorld ./HelloWorld
stdout: stdout:
contains: "Hello from dep1\nHello from dep2" contains: "Hello from dep1\nHello from dep2"
stderr:
contains: ""
exit-status: 0 exit-status: 0
- name: git-dependencies-uses-generated-lockfile - name: git-dependencies-uses-generated-lockfile
@ -437,6 +445,8 @@ tests:
./HelloWorld ./HelloWorld
stdout: stdout:
contains: Hello from dep contains: Hello from dep
stderr:
contains: ""
exit-status: 0 exit-status: 0
- name: git-dependencies-uses-generated-lockfile-update - name: git-dependencies-uses-generated-lockfile-update
@ -530,6 +540,8 @@ tests:
./HelloWorld ./HelloWorld
stdout: stdout:
contains: Hello from commit 2 contains: Hello from commit 2
stderr:
contains: ""
exit-status: 0 exit-status: 0
- name: git-dependencies-nested-lockfile - name: git-dependencies-nested-lockfile
@ -641,6 +653,8 @@ tests:
./HelloWorld ./HelloWorld
stdout: stdout:
contains: "Hello from dep1\nHello from dep2" contains: "Hello from dep1\nHello from dep2"
stderr:
contains: ""
exit-status: 0 exit-status: 0
- name: git-dependencies-update-ref-offline - name: git-dependencies-update-ref-offline
@ -736,6 +750,8 @@ tests:
./HelloWorld ./HelloWorld
stdout: stdout:
contains: This is from the second commit contains: This is from the second commit
stderr:
contains: ""
exit-status: 0 exit-status: 0
- name: git-dependencies-invalid-ref - name: git-dependencies-invalid-ref
@ -790,10 +806,10 @@ tests:
# compile project # compile project
juvix --log-level error compile native HelloWorld.juvix juvix --log-level error compile native HelloWorld.juvix
stdout:
contains: ""
stderr: stderr:
contains: invalid-ref contains: invalid-ref
stdout:
contains: Cloning
exit-status: 1 exit-status: 1
- name: git-dependencies-invalid-url - name: git-dependencies-invalid-url
@ -833,10 +849,10 @@ tests:
# compile project # compile project
juvix --log-level error compile native HelloWorld.juvix juvix --log-level error compile native HelloWorld.juvix
stdout:
contains: ""
stderr: stderr:
contains: Error contains: Error
stdout:
contains: Cloning
exit-status: 1 exit-status: 1
- name: git-dependencies-offline - name: git-dependencies-offline
@ -876,9 +892,10 @@ tests:
# compile project # compile project
juvix --log-level error --offline compile native HelloWorld.juvix juvix --log-level error --offline compile native HelloWorld.juvix
stdout:
contains: ""
stderr: stderr:
contains: Failed to obtain remote dependencies contains: Failed to obtain remote dependencies
stdout:
matches: matches:
# compile should not attempt to clone the dependency # compile should not attempt to clone the dependency
regex: |- regex: |-
@ -950,10 +967,10 @@ tests:
# compile project # compile project
juvix --log-level error compile native HelloWorld.juvix juvix --log-level error compile native HelloWorld.juvix
stdout:
contains: ""
stderr: stderr:
contains: juvix clean contains: juvix clean
stdout:
contains: Cloning
exit-status: 1 exit-status: 1
- name: git-dependencies-duplicate-names - name: git-dependencies-duplicate-names
@ -1077,7 +1094,8 @@ tests:
juvix --log-level error compile native HelloWorld.juvix juvix --log-level error compile native HelloWorld.juvix
./HelloWorld ./HelloWorld
stderr: "" stderr:
contains: ""
stdout: stdout:
matches: matches:
regex: "Hello from dep\n(.*?)Hello from commit2" regex: "Hello from dep\n(.*?)Hello from commit2"
@ -1145,7 +1163,8 @@ tests:
# compile project # compile project
juvix --log-level error compile native HelloWorld.juvix juvix --log-level error compile native HelloWorld.juvix
stderr: ""
stdout: stdout:
contains: ""
stderr:
contains: Cloning contains: Cloning
exit-status: 0 exit-status: 0

View File

@ -6,7 +6,7 @@ tests:
- juvix - juvix
- typecheck - typecheck
stderr: stderr:
equals: "Well done! It type checks\n" contains: "Well done! It type checks\n"
exit-status: 0 exit-status: 0
- name: flag-help-shows-juvix-file-for-autocompletion - name: flag-help-shows-juvix-file-for-autocompletion
@ -25,7 +25,7 @@ tests:
args: args:
- positive/Internal/Simple.juvix - positive/Internal/Simple.juvix
stderr: stderr:
equals: "Well done! It type checks\n" contains: "Well done! It type checks\n"
exit-status: 0 exit-status: 0
- name: flag-only-errors - name: flag-only-errors
@ -82,7 +82,7 @@ tests:
echo 'module foo;' > foo.juvix echo 'module foo;' > foo.juvix
juvix typecheck foo.juvix juvix typecheck foo.juvix
stderr: stderr:
equals: "Well done! It type checks\n" contains: "Well done! It type checks\n"
exit-status: 0 exit-status: 0
- name: typecheck-package-description - name: typecheck-package-description

View File

@ -19,7 +19,7 @@ tests:
regex: |- regex: |-
^(\d+)((\.{1}\d+)*)(\.{0})$ ^(\d+)((\.{1}\d+)*)(\.{0})$
- name: cli-flag-help - name: cli-flag-help
command: command:
- juvix - juvix
- --help - --help
@ -35,7 +35,7 @@ tests:
- doctor - doctor
- --offline - --offline
exit-status: 0 exit-status: 0
stdout: | stderr: |
> Checking for clang... > Checking for clang...
> Checking clang version... > Checking clang version...
> Checking for wasm-ld... > Checking for wasm-ld...
@ -52,7 +52,7 @@ tests:
unset JUVIX_LLVM_DIST_PATH unset JUVIX_LLVM_DIST_PATH
juvix doctor --verbose --offline juvix doctor --verbose --offline
exit-status: 0 exit-status: 0
stdout: stderr:
matches: matches:
regex: |- regex: |-
Found clang(.*?)using system PATH Found clang(.*?)using system PATH
@ -66,7 +66,7 @@ tests:
export JUVIX_LLVM_DIST_PATH=${CLANG_PATH%$'/bin/clang'} export JUVIX_LLVM_DIST_PATH=${CLANG_PATH%$'/bin/clang'}
juvix doctor --verbose --offline juvix doctor --verbose --offline
exit-status: 0 exit-status: 0
stdout: stderr:
matches: matches:
regex: |- regex: |-
Found clang(.*?)using JUVIX_LLVM_DIST_PATH Found clang(.*?)using JUVIX_LLVM_DIST_PATH
@ -79,7 +79,7 @@ tests:
export JUVIX_LLVM_DIST_PATH=/tmp export JUVIX_LLVM_DIST_PATH=/tmp
juvix doctor --verbose --offline juvix doctor --verbose --offline
exit-status: 0 exit-status: 0
stdout: stderr:
matches: matches:
regex: |- regex: |-
Found clang(.*?)using system PATH Found clang(.*?)using system PATH