mirror of
https://github.com/go-task/task.git
synced 2025-07-17 01:43:07 +02:00
Use context on status commands
This commit is contained in:
5
task.go
5
task.go
@ -97,7 +97,7 @@ func RunTask(ctx context.Context, name string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !Force {
|
if !Force {
|
||||||
upToDate, err := t.isUpToDate()
|
upToDate, err := t.isUpToDate(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ func (t *Task) runDeps(ctx context.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Task) isUpToDate() (bool, error) {
|
func (t *Task) isUpToDate(ctx context.Context) (bool, error) {
|
||||||
if len(t.Status) > 0 {
|
if len(t.Status) > 0 {
|
||||||
environ, err := t.getEnviron()
|
environ, err := t.getEnviron()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -149,6 +149,7 @@ func (t *Task) isUpToDate() (bool, error) {
|
|||||||
|
|
||||||
for _, s := range t.Status {
|
for _, s := range t.Status {
|
||||||
err = execext.RunCommand(&execext.RunCommandOptions{
|
err = execext.RunCommand(&execext.RunCommandOptions{
|
||||||
|
Context: ctx,
|
||||||
Command: s,
|
Command: s,
|
||||||
Dir: t.Dir,
|
Dir: t.Dir,
|
||||||
Env: environ,
|
Env: environ,
|
||||||
|
Reference in New Issue
Block a user