https://github.com/JuliaLang/julia
Raw File
Tip revision: 3348de4ea601f78f6c29c8588a7aa36031e75258 authored by Kristoffer Carlsson on 15 November 2021, 08:22:49 UTC
release-1.7: set VERSION to 1.7-rc3 (#43070)
Tip revision: 3348de4
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