-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a trivial Python script to filter the tests and kill Meteor
- Loading branch information
1 parent
af7b27a
commit 1cd2a01
Showing
4 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/python | ||
import sys | ||
import os | ||
|
||
from twisted.internet import stdio, reactor | ||
from twisted.protocols import basic | ||
|
||
class Echo(basic.LineReceiver): | ||
from os import linesep as delimiter | ||
|
||
def exitWithStatusCode(self): | ||
print 'trying to exit' | ||
if self.all_good: | ||
os._exit(0) | ||
else: | ||
os._exit(1) | ||
|
||
def _done(self): | ||
print 'in _done' | ||
os.system('killall -9 node') | ||
reactor.removeAll() | ||
reactor.stop() | ||
|
||
def connectionMade(self): | ||
self.all_good = True | ||
|
||
def lineReceived(self, line): | ||
self.sendLine(line) | ||
|
||
if 'FAIL' in line: | ||
self.all_good = False | ||
self.sendLine("NOTICED A FAILURE!") | ||
reactor.callLater(0.1, self._done) | ||
print 'called later' | ||
|
||
if 'time to exit' in line: | ||
reactor.callLater(0.1, self._done) | ||
|
||
def main(): | ||
e = Echo() | ||
stdio.StandardIO(e) | ||
from twisted.internet import reactor | ||
reactor.run() | ||
e.exitWithStatusCode() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters