WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Replacement for busybox read -t #  (Read 5047 times)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11703
Re: Replacement for busybox read -t #
« Reply #15 on: February 12, 2015, 12:08:14 PM »
Hi centralware
Quote
... but it's going to require peppering "my_function" with checks...
There are no free rides in life my friend. You have to choose synchronous or asynchronous for your keycheck function. If you require
something to complete before interrupting a function, it has to be synchronous and you'll have to add checks where needed. If you
want asynchronous, use two scripts. The first script monitors the keyboard and launches the main script in the background. If a key
is hit, it kills the main script. The while loop in the first script uses ps and grep to know when the main script has completed so it can
terminate.

Offline CentralWare

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 776
Re: Replacement for busybox read -t #
« Reply #16 on: February 12, 2015, 10:38:06 PM »
Rich, it's not the "Free ride" I'm after :)  Well...  not today at least!  It's more of a matter of "notification."

The script I sent tends to capturing CTRL+C and other signals - which works splendidly (if being told to shut down externally, respond with "I'm doin' it!" and finish the process.)

Considering my_function is VERY bouncy (has about a dozen other functions it relies on to tend to an extension scraper, scanner, binary compare...  all the way down to rebuilding (squashing), thus peppering this would be rather vast...  even if nothing more than checking to see if a key was pressed and then responding with a message, then following through the rest of that loop before exiting.

Thank you for all of your insight.  We'll see how this pans out! :)