https://github.com/JuliaLang/julia
Raw File
Tip revision: f57d29dd51944d513d5d9b7992520b25fd22d7f0 authored by Rafael Fourquet on 26 April 2021, 13:29:35 UTC
add `zeros!` and `ones!`, mutating versions of `zeros` and `ones`
Tip revision: f57d29d
stack_overflow.jl
# This file is a part of Julia. License is MIT: https://julialang.org/license

using Test

# helper function for returning stderr and stdout
# from running a command (ignoring failure status)
function readchomperrors(exename::Cmd)
    out = Base.PipeEndpoint()
    err = Base.PipeEndpoint()
    p = run(exename, devnull, out, err, wait=false)
    o = @async(readchomp(out))
    e = @async(readchomp(err))
    return (success(p), fetch(o), fetch(e))
end

let exename = Base.julia_cmd()
    @show readchomperrors(`$exename -e "f() = f(); f()"`)
    @show readchomperrors(`$exename -e "f() = f(); fetch(@async f())"`)
end
back to top