mirror of
https://github.com/go-task/task.git
synced 2025-11-23 22:24:45 +02:00
refactor: check if the remote exists just before reading it (#1713)
* refactor: check if the remote exists in the read to avoid doing it in offline mode * fix: timeout error was not working * fix: use cached copy if available
This commit is contained in:
@@ -208,8 +208,9 @@ func (r *Reader) readNode(node Node) (*ast.Taskfile, error) {
|
||||
|
||||
// Read the file
|
||||
b, err = node.Read(ctx)
|
||||
var taskfileNetworkTimeoutError *errors.TaskfileNetworkTimeoutError
|
||||
// If we timed out then we likely have a network issue
|
||||
if node.Remote() && errors.Is(ctx.Err(), context.DeadlineExceeded) {
|
||||
if node.Remote() && errors.As(err, &taskfileNetworkTimeoutError) {
|
||||
// If a download was requested, then we can't use a cached copy
|
||||
if r.download {
|
||||
return nil, &errors.TaskfileNetworkTimeoutError{URI: node.Location(), Timeout: r.timeout}
|
||||
|
||||
Reference in New Issue
Block a user