How can I execute a binary through ruby for a limited time? -


i want run binary through ruby limited time. in case airodump-ng full command of:

airodump-ng -c <mychan> mon0 --essid "my_wlan" --write capture 

for ones don't know airdump-ng normal starts , doesn't terminate itself. running forever if user doesn't stop pressing strg + c. isn't problem @ bash executing through ruby it's causing serious trouble. there way limit time binary runned system method?

try timeout library:

require 'timeout'  begin   timeout.timeout(30)     system('airodump-ng -c <mychan> mon0 --essid "my_wlan" --write capture')   end rescue timeout::error   # timeout end 

Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -