youversion / crony

Cron monitoring for use with cronitor.io & sentry.io
MIT License
8 stars 2 forks source link

switch to using Popen to execute cmd #10

Closed chrisvaughn closed 6 years ago

chrisvaughn commented 6 years ago
chrisvaughn commented 6 years ago

for testing I did the following:

basic test case

>> ./crony-runner.py echo "hello"
2017-12-03T08:34:47 INFO: No config file found.
2017-12-03T08:34:47 INFO: hello

error case

>> ./crony-runner.py cat /filethatdoesntexist
2017-12-03T08:35:43 INFO: No config file found.
2017-12-03T08:35:43 INFO: cat: /filethatdoesntexist: No such file or directory
2017-12-03T08:35:43 ERROR: Error running command! Exit status: 1, cat: /filethatdoesntexist: No such file or directory
>> echo $?
1

case for output while command is running

  1. create a test file runloop.sh
    for number in {1..10}; do echo "$number "; sleep 1; done
  2. execute
    
    >> ./crony-runner.py bash runloop.sh
    2017-12-03T08:38:23 INFO: No config file found.
    2017-12-03T08:38:23 INFO: 1
    2017-12-03T08:38:24 INFO: 2
    2017-12-03T08:38:25 INFO: 3
    2017-12-03T08:38:26 INFO: 4
    2017-12-03T08:38:27 INFO: 5
    2017-12-03T08:38:28 INFO: 6
    2017-12-03T08:38:29 INFO: 7
    2017-12-03T08:38:30 INFO: 8
    2017-12-03T08:38:31 INFO: 9
    2017-12-03T08:38:32 INFO: 10
    >> echo $?
    0
chrisvaughn commented 6 years ago

Fixes #9

bbelyeu commented 6 years ago

👀 💯 👍

bbelyeu commented 6 years ago

next time if you add "Fixes #9" in the commit message when it's merged I believe it auto closes the open issue.

bbelyeu commented 6 years ago

https://help.github.com/articles/closing-issues-using-keywords/#closing-an-issue-in-the-same-repository