Merge pull request #4 from schoonc/typos-imports-pep8

fixed typos, imports; pep8
This commit is contained in:
derv authored and GitHub committed 2016-10-03 10:44:57 -07:00
commit 293c05a80c
2 files changed
+14 -12

No files matched your search

+13 -11
View File
@@ -1,11 +1,12 @@
#!/usr/bin/python2.7 #!/usr/bin/python2.7
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from Configuration import Configuration
from Color import Color
from subprocess import Popen, call, PIPE
import time import time
from subprocess import Popen, PIPE
from Color import Color
from Configuration import Configuration
class Process(object): class Process(object):
''' Represents a running/ran process ''' ''' Represents a running/ran process '''
@@ -16,7 +17,7 @@ class Process(object):
return open('/dev/null', 'w') return open('/dev/null', 'w')
@staticmethod @staticmethod
def call(command, cwd=None,shell=False): def call(command, cwd=None, shell=False):
''' '''
Calls a command (either string or list of args). Calls a command (either string or list of args).
Returns tuple: Returns tuple:
@@ -49,7 +50,7 @@ class Process(object):
stdout = p.stdout().strip() stdout = p.stdout().strip()
stderr = p.stderr().strip() stderr = p.stderr().strip()
if stdout == '' and err == '': if stdout == '' and stderr == '':
return False return False
return True return True
@@ -131,7 +132,7 @@ class Process(object):
pid = self.pid.pid pid = self.pid.pid
kill(pid, SIGINT) kill(pid, SIGINT)
wait_time = 0 # Time since Interrupt was sent wait_time = 0 # Time since Interrupt was sent
while self.pid.poll() == None: while self.pid.poll() == None:
# Process is still running # Process is still running
wait_time += 0.1 wait_time += 0.1
@@ -148,20 +149,21 @@ class Process(object):
return return
raise e # process cannot be killed raise e # process cannot be killed
if __name__ == '__main__': if __name__ == '__main__':
p = Process('ls') p = Process('ls')
print p.stdout(), p.stderr() print p.stdout(), p.stderr()
p.interrupt() p.interrupt()
# Calling as list of arguments # Calling as list of arguments
(out,err) = Process.call(['ls', '-lah']) (out, err) = Process.call(['ls', '-lah'])
print out,err print out, err
print '\n---------------------\n' print '\n---------------------\n'
# Calling as string # Calling as string
(out,err) = Process.call('ls -l | head -2') (out, err) = Process.call('ls -l | head -2')
print out,err print out, err
print '"reaver" exists:', Process.exists('reaver') print '"reaver" exists:', Process.exists('reaver')
+1 -1
View File
@@ -24,7 +24,7 @@ class Wash(object):
wash_name = 'wash' wash_name = 'wash'
if not Process.exists(wash_name): if not Process.exists(wash_name):
wash_name = 'walsh' wash_name = 'walsh'
if not Proces.exists(wash_name): if not Process.exists(wash_name):
# Wash isn't found, drop out # Wash isn't found, drop out
return return