See this PR: https://github.com/JuliaLang/julia/pull/12807/files
This is a change to `open` that would allow capturing STDERR the way you want. This change won't make it into v0.4, but the code in there could point you towards a solution. I hope to have some time soon to dive into this (I need to implement the same thing in Gaston). -- mb On Sat, Sep 12, 2015 at 10:47 AM, J Luis <[email protected]> wrote: > Right, that's indeed what is (very sadly) happening. It turned out that > the stderr output is the part that I really need in this case. > The only working solution I found was to do > > run(pipeline(ignorestatus(cmd), stdout=DevNull, stderr="errs.txt")) > t = readall("errs.txt"); > > but it's annoying having to write a disk file and read its contents. > > Had some hope on this one, but no way too > > julia> readall(run(pipeline(ignorestatus(cm), STDOUT, STDOUT))) > Image Difference (RootMeanSquaredError): > Normalized Absolute > ============ ========== > Red: 0.3709618690 24311.0 > Green: 0.3611391197 23667.3 > Blue: 0.2638682470 17292.6 > Total: 0.3354900017 21986.3 > C:/programs/GraphicsMagick/gm.exe compare: image difference exceeds limit > (0.33549 > 0.001). > ERROR: MethodError: `readall` has no method matching readall(::Void) > > and this one completely hangs the REPL giviing me no choice but killing > the shell window > > rd,wr=redirect_stderr(); > run(pipeline(ignorestatus(cmd), stdout=DevNull, stderr=rd)) > > now if try to read from 'rd' > > readall(rd) # ---> IceAge > > > sábado, 12 de Setembro de 2015 às 15:35:39 UTC+1, Miguel Bazdresch > escreveu: >> >> What could be happening is that `gm.exe` is printing that message to >> STDERR, which is not captured by `readall()`. In theory, the new pipeline >> infrastructure should let you capture STDERR, but I haven't had the time to >> figure out exactly how. Maybe somebody who knows will chime in. >> >> -- mb >> >> On Fri, Sep 11, 2015 at 9:17 PM, J Luis <[email protected]> wrote: >> >>> Found a ignorestatus function. Better, but not yet good enough. It still >>> prints a message even if using a suppression ';' >>> >>> julia> readall(ignorestatus(cm)); >>> C:/programs/GraphicsMagick/gm.exe compare: image difference exceeds >>> limit (0.336711 > 0.001). >>> >>> >>> sábado, 12 de Setembro de 2015 às 02:00:25 UTC+1, J Luis escreveu: >>>> >>>> Thanks. It turned out my main error was that I was build the Cmd object >>>> by first creating the command as a string and after wrapping it in back >>>> ticks. >>>> >>>> But I continue in troubles. Right, I can run the command, a >>>> GraphicsMagic image comparison command, but when that comparison say the >>>> two images are different gm.exe returns an error code != 0 and Julia >>>> interprets it a command error. But it isn't, it only means the two images >>>> are different. As a consequence the julia function where this happens >>>> aborts (an example in REPL bellow). >>>> >>>> I tried with a try catch but not even that prevented the function >>>> abortion. How can I get out of this one? >>>> >>>> julia> readall(cm) >>>> C:/programs/GraphicsMagick/gm.exe compare: image difference exceeds >>>> limit (0.33549 > 0.001). >>>> ERROR: failed process: Process(`C:/programs/GraphicsMagick/gm.exe >>>> compare -density 200 -maximum-error 0.001 -highlight-color magenta >>>> -highlight-style assign -metric rmse -file V:/example_02.png >>>> C:/progs_cygw/GMTdev/gmt5/branches/5.2.0/doc/examples/ex02/ >>>> example_02.ps V:/example_02.ps`, ProcessExited(1)) [1] >>>> in pipeline_error at process.jl:548 >>>> >>>> sábado, 12 de Setembro de 2015 às 01:17:57 UTC+1, Simon Kornblith >>>> escreveu: >>>>> >>>>> readall(`cat test`) or similar >>>>> >>>>> On Friday, September 11, 2015 at 7:56:43 PM UTC-4, J Luis wrote: >>>>>> >>>>>> Ok, I've spend about an hour around "run" "open", "run(pipeline(..." >>>>>> but no way. >>>>>> In Matlab I would do >>>>>> >>>>>> [status, cmdout] = system(cmd); >>>>>> >>>>>> but in Julia the most a can reach is to run the command >>>>>> >>>>>> com = "C:/programs/GraphicsMagick/gm.exe compare -density 200 ... >>>>>> >>>>>> run(`com') >>>>>> >>>>>> but I need the result of that execution. >>>>>> How to? >>>>>> >>>>>> Thanks >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>
