| 
22 | 22 | 
 
  | 
23 | 23 | @safetestset "Run trim" begin  | 
24 | 24 |     # https://discourse.julialang.org/t/capture-stdout-and-stderr-in-case-a-command-fails/101772/3?u=romeov  | 
25 |  | -    "Run a Cmd object, returning the stdout & stderr contents plus the exit code"  | 
 | 25 | +    """  | 
 | 26 | +    Run a Cmd object, returning the stdout & stderr contents plus the exit code  | 
 | 27 | +    """  | 
26 | 28 |     function _execute(cmd::Cmd)  | 
27 | 29 |         out = Pipe()  | 
28 | 30 |         err = Pipe()  | 
 | 
31 | 33 |         close(err.in)  | 
32 | 34 |         out = (  | 
33 | 35 |             stdout = String(read(out)), stderr = String(read(err)),  | 
34 |  | -            exitcode = process.exitcode,  | 
 | 36 | +            exitcode = process.exitcode  | 
35 | 37 |         )  | 
36 | 38 |         return out  | 
37 | 39 |     end  | 
38 | 40 | 
 
  | 
39 | 41 |     JULIAC = normpath(  | 
40 | 42 |         joinpath(  | 
41 |  | -            Sys.BINDIR, Base.DATAROOTDIR, "julia", "juliac",  | 
42 |  | -            "juliac.jl"  | 
43 |  | -        )  | 
 | 43 | +        Sys.BINDIR, Base.DATAROOTDIR, "julia", "juliac",  | 
 | 44 | +        "juliac.jl"  | 
 | 45 | +    )  | 
44 | 46 |     )  | 
45 | 47 |     @test isfile(JULIAC)  | 
46 | 48 | 
 
  | 
47 | 49 |     for (mainfile, expectedtopass) in [  | 
48 |  | -            ("main_trimmable.jl", true),  | 
49 |  | -            #= The test below should verify that we indeed can't get a trimmed binary  | 
50 |  | -            # for the "clean" implementation, but will trigger in the future if  | 
51 |  | -            # it does start working. Unfortunately, right now it hangs indefinitely  | 
52 |  | -            # so we are commenting it out. =#  | 
53 |  | -            # ("main_clean.jl", false),  | 
54 |  | -        ]  | 
 | 50 | +        ("main_trimmable.jl", true),  | 
 | 51 | +    #= The test below should verify that we indeed can't get a trimmed binary  | 
 | 52 | +    # for the "clean" implementation, but will trigger in the future if  | 
 | 53 | +    # it does start working. Unfortunately, right now it hangs indefinitely  | 
 | 54 | +    # so we are commenting it out. =#  | 
 | 55 | +    # ("main_clean.jl", false),  | 
 | 56 | +    ]  | 
55 | 57 |         binpath = tempname()  | 
56 | 58 |         cmd = `$(Base.julia_cmd()) --project=. --depwarn=error $(JULIAC) --experimental --trim=unsafe-warn --output-exe $(binpath) $(mainfile)`  | 
57 | 59 | 
 
  | 
 | 
0 commit comments