Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gargantext-ihaskell
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
gargantext-ihaskell
Commits
555a6501
Commit
555a6501
authored
Jun 28, 2019
by
Vaibhav Sagar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src/IHaskell/Eval/Evaluate.hs: capture stderr
parent
ac478079
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
Evaluate.hs
src/IHaskell/Eval/Evaluate.hs
+11
-3
Eval.hs
src/tests/IHaskell/Test/Eval.hs
+6
-0
No files found.
src/IHaskell/Eval/Evaluate.hs
View file @
555a6501
...
@@ -1104,7 +1104,10 @@ capturedEval output stmt = do
...
@@ -1104,7 +1104,10 @@ capturedEval output stmt = do
writeVariable
=
var
"file_write_var_"
writeVariable
=
var
"file_write_var_"
-- Variable where to store old stdout.
-- Variable where to store old stdout.
oldVariable
=
var
"old_var_"
oldVariableStdout
=
var
"old_var_stdout_"
-- Variable where to store old stderr.
oldVariableStderr
=
var
"old_var_stderr_"
-- Variable used to store true `it` value.
-- Variable used to store true `it` value.
itVariable
=
var
"it_var_"
itVariable
=
var
"it_var_"
...
@@ -1115,9 +1118,12 @@ capturedEval output stmt = do
...
@@ -1115,9 +1118,12 @@ capturedEval output stmt = do
initStmts
=
initStmts
=
[
printf
"let %s = it"
itVariable
[
printf
"let %s = it"
itVariable
,
printf
"(%s, %s) <- IHaskellIO.createPipe"
readVariable
writeVariable
,
printf
"(%s, %s) <- IHaskellIO.createPipe"
readVariable
writeVariable
,
printf
"%s <- IHaskellIO.dup IHaskellIO.stdOutput"
oldVariable
,
printf
"%s <- IHaskellIO.dup IHaskellIO.stdOutput"
oldVariableStdout
,
printf
"%s <- IHaskellIO.dup IHaskellIO.stdError"
oldVariableStderr
,
voidpf
"IHaskellIO.dupTo %s IHaskellIO.stdOutput"
writeVariable
,
voidpf
"IHaskellIO.dupTo %s IHaskellIO.stdOutput"
writeVariable
,
voidpf
"IHaskellIO.dupTo %s IHaskellIO.stdError"
writeVariable
,
voidpf
"IHaskellSysIO.hSetBuffering IHaskellSysIO.stdout IHaskellSysIO.NoBuffering"
,
voidpf
"IHaskellSysIO.hSetBuffering IHaskellSysIO.stdout IHaskellSysIO.NoBuffering"
,
voidpf
"IHaskellSysIO.hSetBuffering IHaskellSysIO.stderr IHaskellSysIO.NoBuffering"
,
printf
"let it = %s"
itVariable
,
printf
"let it = %s"
itVariable
]
]
...
@@ -1125,7 +1131,9 @@ capturedEval output stmt = do
...
@@ -1125,7 +1131,9 @@ capturedEval output stmt = do
postStmts
=
postStmts
=
[
printf
"let %s = it"
itVariable
[
printf
"let %s = it"
itVariable
,
voidpf
"IHaskellSysIO.hFlush IHaskellSysIO.stdout"
,
voidpf
"IHaskellSysIO.hFlush IHaskellSysIO.stdout"
,
voidpf
"IHaskellIO.dupTo %s IHaskellIO.stdOutput"
oldVariable
,
voidpf
"IHaskellSysIO.hFlush IHaskellSysIO.stderr"
,
voidpf
"IHaskellIO.dupTo %s IHaskellIO.stdOutput"
oldVariableStdout
,
voidpf
"IHaskellIO.dupTo %s IHaskellIO.stdError"
oldVariableStderr
,
voidpf
"IHaskellIO.closeFd %s"
writeVariable
,
voidpf
"IHaskellIO.closeFd %s"
writeVariable
,
printf
"let it = %s"
itVariable
,
printf
"let it = %s"
itVariable
]
]
...
...
src/tests/IHaskell/Test/Eval.hs
View file @
555a6501
...
@@ -169,3 +169,9 @@ testEval =
...
@@ -169,3 +169,9 @@ testEval =
#
endif
#
endif
":k Maybe"
`
becomes
`
[
"Maybe :: * -> *"
]
":k Maybe"
`
becomes
`
[
"Maybe :: * -> *"
]
":in String"
`
pages
`
[
"type String = [Char]
\t
-- Defined in
\8216
GHC.Base
\8217
"
]
":in String"
`
pages
`
[
"type String = [Char]
\t
-- Defined in
\8216
GHC.Base
\8217
"
]
it
"captures stderr"
$
do
[
hereLit
|
import Debug.Trace
trace "test" 5
|]
`
becomes
`
[
"test
\n
5"
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment