@@ -2,6 +2,21 @@ import fs = require('fs');
22import path = require( 'path' ) ;
33import tl = require( 'azure-pipelines-task-lib/task' ) ;
44
5+ /**
6+ * Shows timestamp change operation results
7+ * @param fileStats file stats
8+ * @param err error - null if there is no error
9+ */
10+ function displayTimestampChangeResults (
11+ fileStats : tl . FsStats ,
12+ err : NodeJS . ErrnoException
13+ ) {
14+ if ( err ) {
15+ console . warn ( `Problem applying the timestamp: ${ err } ` ) ;
16+ } else {
17+ console . log ( `Timestamp preserved successfully - access time: ${ fileStats . atime } , modified time: ${ fileStats . mtime } ` )
18+ }
19+ }
520
621// we allow broken symlinks - since there could be broken symlinks found in source folder, but filtered by contents pattern
722const findOptions : tl . FindOptions = {
@@ -124,7 +139,7 @@ if (matchedFiles.length > 0) {
124139 try {
125140 const fileStats = tl . stats ( file ) ;
126141 fs . utimes ( targetPath , fileStats . atime , fileStats . mtime , ( err ) => {
127- console . warn ( `Problem applying the timestamp: ${ err } ` ) ;
142+ displayTimestampChangeResults ( fileStats , err ) ;
128143 } ) ;
129144 }
130145 catch ( err ) {
@@ -160,7 +175,7 @@ if (matchedFiles.length > 0) {
160175 try {
161176 const fileStats : tl . FsStats = tl . stats ( file ) ;
162177 fs . utimes ( targetPath , fileStats . atime , fileStats . mtime , ( err ) => {
163- console . warn ( `Problem applying the timestamp: ${ err } ` ) ;
178+ displayTimestampChangeResults ( fileStats , err ) ;
164179 } ) ;
165180 }
166181 catch ( err ) {
0 commit comments