(b conf.Block, mod *moddwatch.Mod, dpen *DaemonPen)
| 107 | } |
| 108 | |
| 109 | func (mr *ModRunner) runBlock(b conf.Block, mod *moddwatch.Mod, dpen *DaemonPen) { |
| 110 | if b.InDir != "" { |
| 111 | currentDir, err := os.Getwd() |
| 112 | if err != nil { |
| 113 | mr.Log.Shout("Error getting current working directory: %s", err) |
| 114 | return |
| 115 | } |
| 116 | err = os.Chdir(b.InDir) |
| 117 | if err != nil { |
| 118 | mr.Log.Shout( |
| 119 | "Error changing to indir directory \"%s\": %s", |
| 120 | b.InDir, |
| 121 | err, |
| 122 | ) |
| 123 | return |
| 124 | } |
| 125 | defer func() { |
| 126 | err := os.Chdir(currentDir) |
| 127 | if err != nil { |
| 128 | mr.Log.Shout("Error returning to original directory: %s", err) |
| 129 | } |
| 130 | }() |
| 131 | } |
| 132 | err := RunPreps( |
| 133 | b, |
| 134 | mr.Config.GetVariables(), |
| 135 | mod, mr.Log, |
| 136 | mr.Notifiers, |
| 137 | mod == nil, |
| 138 | ) |
| 139 | if err != nil { |
| 140 | if _, ok := err.(ProcError); !ok { |
| 141 | mr.Log.Shout("Error running prep: %s", err) |
| 142 | } |
| 143 | return |
| 144 | } |
| 145 | dpen.Restart() |
| 146 | } |
| 147 | |
| 148 | func (mr *ModRunner) trigger(root string, mod *moddwatch.Mod, dworld *DaemonWorld) { |
| 149 | for i, b := range mr.Config.Blocks { |
no test coverage detected