You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That's only within a thread, right? Outside the thread you're not guaranteed that.
So what about this:
Hatchet::Runner.new("default_ruby", run_multi: true)
app.run_multi("ls") do |out, status|
expect(status.success?).to be_truthy
expect(out).to include("Gemfile")
end
app.run_multi("ruby -v") do |out, status|
expect(status.success?).to be_truthy
expect(out).to include("ruby")
end
puts $?
end
The above code would be a bug.
In this case `$?` should be empty as `$?` is thread local and the run_multi
blocks are executed in a different thread. If it has a value, then it's
reflecting the last value in it's current thread and not from one of the
`run_multi` values.
That's why `run_multi` yields a status value in addition to the output so
that it's easier to be sure about the behavior of checking the status.
Activity
schneems commentedon Jan 13, 2021
That's not true.
$?
is threadsafe:or
dzuelke commentedon Jan 14, 2021
That's only within a thread, right? Outside the thread you're not guaranteed that.
So what about this:
Which of the two runs'
$?
willputs
print?schneems commentedon Jan 14, 2021
4 remaining items