#NEWLINE# def is_pid_cmdline_correct( pid , match ) : #NEWLINE# #INDENT# 'Ensure that the cmdline for a pid seems sane\n\n    Because pids are recycled, blindly killing by pid is something to\n    avoid. This provides the ability to include a substring that is\n    expected in the cmdline as a safety check.\n    ' #NEWLINE# try : #NEWLINE# #INDENT# with open ( ( '/proc/%d/cmdline' % pid ) ) as f : #NEWLINE# #INDENT# cmdline = f . read ( ) #NEWLINE# return ( match in cmdline ) #NEWLINE# #UNINDENT# #UNINDENT# except EnvironmentError : #NEWLINE# #INDENT# return False