File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -561,12 +561,14 @@ func (s *Script) waitForActiveBuilds() bool {
561561 return false
562562}
563563
564- func touchFile (file string ) (err error ) {
564+ func touchFile (file string , onlyIfExists bool ) (err error ) {
565565 _ , err = os .Stat (file )
566566 if os .IsNotExist (err ) {
567- var f * os.File
568- f , err = os .Create (file )
569- defer f .Close ()
567+ if ! onlyIfExists {
568+ var f * os.File
569+ f , err = os .Create (file )
570+ defer f .Close ()
571+ }
570572 } else {
571573 currentTime := time .Now ().Local ()
572574 err = os .Chtimes (file , currentTime , currentTime )
@@ -577,7 +579,8 @@ func touchFile(file string) (err error) {
577579// run runs the binary and marks when it was last run (by touching a file alongside the binary)
578580func (s * Script ) run () (err error ) {
579581 if s .cleanSecs >= 0 {
580- _ = touchFile (s .binaryLastRun )
582+ _ = touchFile (s .binaryLastRun , false )
583+ _ = touchFile (s .binary , true )
581584 }
582585 err = syscall .Exec (s .binary , s .args , os .Environ ())
583586 return
You can’t perform that action at this time.
0 commit comments