1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-02 01:04:57 +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 r a
runLogIO sem = do
liftIO (hSetBuffering stdout LineBuffering)
liftIO (hSetBuffering stderr LineBuffering)
interpret
( \case
Log txt -> putStrLn txt
Log txt -> hPutStrLn stderr txt
)
sem

View File

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

View File

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

View File

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

View File

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