diff src/main/kotlin/name/blackcap/passman/Main.kt @ 28:287eadf5ab30 default tip

Check for timeouts inside subcommands while in interactive mode as well.
author David Barts <n5jrn@me.com>
date Wed, 31 Jul 2024 11:21:18 -0700
parents 3a3067ba673b
children
line wrap: on
line diff
--- a/src/main/kotlin/name/blackcap/passman/Main.kt	Sat Jul 27 09:50:54 2024 -0700
+++ b/src/main/kotlin/name/blackcap/passman/Main.kt	Wed Jul 31 11:21:18 2024 -0700
@@ -78,6 +78,7 @@
             lastStatus = 2
             continue
         }
+        val beforeRun = System.currentTimeMillis()
         try {
             runSubcommand(subcommand, scArgs)
             lastStatus = 0
@@ -88,6 +89,11 @@
             handleMessagedException(e)
             lastStatus = 1
         }
+        if (System.currentTimeMillis() - beforeRun > MAX_TIME_MILLIS) {
+            error("time limit exceeded, goodbye!")
+            lastStatus = 1
+            break
+        }
     }
     exitProcess(lastStatus)
 }