File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -145,15 +145,24 @@ def run(args: str | list[str], cd: PathLike | None = None) -> None:
145145 """
146146 cmd = " " .join (args )
147147 print (">> Running command:" , cmd )
148- start_time = time .time ()
148+ start_time = time .perf_counter ()
149149 if cd is not None :
150150 with cd_context (_resolve (cd , strict = True )):
151151 result = subprocess .run (args )
152152 else :
153153 result = subprocess .run (args )
154- elapsed_time = time .time () - start_time
155- minutes , seconds = divmod (elapsed_time , 60 )
156- print (f">> Command finished ({ int (minutes )} m { int (seconds )} s): { cmd } \n " )
154+
155+ elapsed_time = time .perf_counter () - start_time
156+ h , rem = divmod (elapsed_time , 3600 )
157+ m , s = divmod (rem , 60 )
158+
159+ time_str = " " .join (part for part in [
160+ f"{ int (h )} h" if h >= 1 else "" ,
161+ f"{ int (m )} m" if m >= 1 or h >= 1 else "" ,
162+ f"{ int (s )} s"
163+ ] if part )
164+
165+ print (f">> Command finished ({ time_str } ): { cmd } \n " )
157166
158167 # TODO: Should we exit here? Or continue to let other commands run also?
159168 if result .returncode != 0 :
You can’t perform that action at this time.
0 commit comments