Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
33 changes: 22 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,58 @@ name: CI

on:
push:
branches: "master"
branches:
- "master"
- "release-*"
tags: ["*"]
pull_request:
release:

jobs:
test:
name: Julia ${{ matrix.julia-version }} - ${{ matrix.os }} - ${{ matrix.julia-arch }}
name: Julia ${{ matrix.julia-version }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
JULIA_NUM_THREADS: auto
strategy:
fail-fast: false
matrix:
julia-version:
- "1.0"
- "min"
- "1"
- "nightly"
os:
- ubuntu-latest
- macos-latest
julia-arch:
- x64
- default
exclude:
- julia-version: "min"
os: macos-latest
steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
- uses: actions/checkout@v6
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.julia-version }}
arch: ${{ matrix.julia-arch }}
- uses: julia-actions/cache@v1
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
continue-on-error: true

Documentation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@latest
- uses: actions/checkout@v6
- uses: julia-actions/setup-julia@v2
with:
version: 1
- uses: julia-actions/cache@v1
- uses: julia-actions/cache@v2
with:
cache-registries: "true"
- uses: julia-actions/julia-docdeploy@v1
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name = "OutputCollectors"
uuid = "6c11c7d4-943b-4e2b-80de-f2cfc2930a8c"
authors = ["Elliot Saba <[email protected]>"]
version = "0.1.1"
version = "0.1.2"

[compat]
julia = "1"
julia = "1.6"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
2 changes: 2 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ makedocs(
deploydocs(
repo = "github.com/JuliaPackaging/OutputCollectors.jl.git",
push_preview = true,
devbranch = "master",
versions = ["v0.1" => "release-0.1", "v1" => "master", "v#.#"],
)
14 changes: 7 additions & 7 deletions src/OutputCollectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Given a `Pipe` that has been initialized by `spawn()`, create an async Task to
read in lines as they come in and annotate the time the line was captured for
later replay/merging with other simultaneously captured streams.
"""
function LineStream(pipe::Pipe, event::Condition)
function LineStream(pipe::Pipe, event::Threads.Condition)
# We always have to close() the input half of the stream before we can
# read() from it. I don't know why, and this is honestly kind of annoying
close(pipe.in)
Expand All @@ -65,7 +65,7 @@ function LineStream(pipe::Pipe, event::Condition)
break
end
push!(lines, (time(), line))
notify(event)
Base.@lock event notify(event)
end
end

Expand All @@ -74,7 +74,7 @@ function LineStream(pipe::Pipe, event::Condition)
# being alive (e.g. `tee()`) can die alongside us gracefully as well.
@async begin
fetch(task)
notify(event)
Base.@lock event notify(event)
end
return LineStream(pipe, lines, task)
end
Expand All @@ -101,7 +101,7 @@ mutable struct OutputCollector
P::Base.AbstractPipe
stdout_linestream::LineStream
stderr_linestream::LineStream
event::Condition
event::Threads.Condition
tee_stream::IO
verbose::Bool
tail_error::Bool
Expand Down Expand Up @@ -136,7 +136,7 @@ function OutputCollector(cmd::Base.AbstractCmd; verbose::Bool=false,
end

# Next, start siphoning off the first couple lines of output and error
event = Condition()
event = Threads.Condition()
out_ls = LineStream(out_pipe, event)
err_ls = LineStream(err_pipe, event)

Expand Down Expand Up @@ -345,15 +345,15 @@ function tee(c::OutputCollector; colored::Bool=get_have_color(),

# First thing, wait for some input. This avoids us trying to inspect
# the liveliness of the linestreams before they've even started.
wait(c.event)
Base.@lock c.event wait(c.event)

while alive(c.stdout_linestream) || alive(c.stderr_linestream)
if length(out_lines) >= out_idx || length(err_lines) >= err_idx
# If we have data to output, then do so
print_next_line()
else
# Otherwise, wait for more input
wait(c.event)
Base.@lock c.event wait(c.event)
end
end

Expand Down
Loading