File tree Expand file tree Collapse file tree 5 files changed +37
-18
lines changed
Expand file tree Collapse file tree 5 files changed +37
-18
lines changed Original file line number Diff line number Diff line change 11name : CI
22on :
3- - push
4- - pull_request
3+ push :
4+ branches :
5+ - main
6+ tags : ' *'
7+ pull_request :
58jobs :
69 test :
710 name : Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
1013 fail-fast : false
1114 matrix :
1215 version :
13- - ' 1.5 '
16+ - ' 1.6 '
1417 - ' 1'
1518 - ' nightly'
1619 os :
Original file line number Diff line number Diff line change 11name = " ResourceContexts"
22uuid = " 8d208092-d35c-4dd3-a0d7-8325f9cce6b4"
33authors = [" Chris Foster <chris42f@gmail.com> and contributors" ]
4- version = " 0.1.0 "
4+ version = " 0.1.1 "
55
66[deps ]
77Logging = " 56ddb016-857b-54e1-b83d-db4d58db5568"
@@ -11,6 +11,7 @@ julia = "1.5"
1111
1212[extras ]
1313Test = " 8dfed614-e22c-5e08-85e1-65c5234f0b40"
14+ Compat = " 34da2185-b29b-5c13-b0c7-acf172513d20"
1415
1516[targets ]
16- test = [" Test" ]
17+ test = [" Test" , " Compat " ]
Original file line number Diff line number Diff line change 4545
4646# Standard streams
4747
48+ # Incompatibility due to
49+ # https://github.com/JuliaLang/julia/pull/39132
50+ @static if VERSION < v " 1.7"
51+
4852@! function Base. redirect_stdout (stream)
4953 prev_stream = stdout
5054 x = redirect_stdout (stream)
6670 x
6771end
6872
73+ else
74+
75+ @! function (f:: Base.RedirectStdStream )(stream)
76+ # See https://github.com/JuliaLang/julia/blob/294b0dfcd308b3c3f829b2040ca1e3275595e058/base/stream.jl#L1417
77+ stdold = f. unix_fd == 0 ? stdin :
78+ f. unix_fd == 1 ? stdout :
79+ f. unix_fd == 2 ? stderr :
80+ throw (ArgumentError (" Not implemented to get old handle of fd except for stdio" ))
81+ x = f (stream)
82+ @defer f (stdold)
83+ x
84+ end
85+
86+ @! function Base. redirect_stdio (; kws... )
87+ @! enter_do (redirect_stdio; kws... )
88+ end
89+
90+ end
Original file line number Diff line number Diff line change 9797 seek (io, 0 )
9898 stderr_result = readline (io)
9999 end
100- if VERSION < v " 1.7-DEV"
101- @test stderr_result == " hi"
102- else
103- @test_broken stderr_result == " hi"
104- end
100+ @test stderr_result == " hi"
105101
106102 stdin_result = nothing
107103 @context begin
112108 @! redirect_stdin (io)
113109 stdin_result = readline ()
114110 end
115- if VERSION < v " 1.7-DEV"
116- @test stdin_result == " hi"
117- else
118- @test_broken stdin_result == " hi"
119- end
111+ @test stdin_result == " hi"
120112
121113 @test orig_stdin == stdin
122114 @test orig_stdout == stdout
Original file line number Diff line number Diff line change 11using ResourceContexts
22using Test
33using Logging
4+ using Compat
45
56# Use of @! to pass context to resource creation function
67@! function foo (x, label)
3536 @defer error (" B" )
3637 end
3738 catch exc
38- stack = Base . catch_stack ()
39+ stack = current_exceptions ()
3940 @test stack[1 ][1 ] == ErrorException (" B" )
4041 @test stack[2 ][1 ] == ErrorException (" A" )
4142 end
9293 end
9394 catch e
9495 @test e isa TaskFailedException
95- first (Base . catch_stack (e. task))[1 ]
96+ first (current_exceptions (e. task))[1 ]
9697 end == ErrorException (" Oops1" )
9798
9899 @test try
101102 end
102103 catch e
103104 @test e isa TaskFailedException
104- first (Base . catch_stack (e. task))[1 ]
105+ first (current_exceptions (e. task))[1 ]
105106 end == ErrorException (" Oops2" )
106107end
107108
You can’t perform that action at this time.
0 commit comments