1717parser .add_argument ('--check-library' , action = 'store_true' , help = 'passed through to binary if supported' )
1818parser .add_argument ('--timeout' , type = int , default = 2 , help = 'the amount of seconds to wait for the analysis to finish' )
1919parser .add_argument ('--compact' , action = 'store_true' , help = 'only print versions with changes with --compare' )
20+ parser .add_argument ('--no-quiet' , action = 'store_true' , default = False , help = 'do not specify -q' )
21+ parser .add_argument ('--no-stderr' , action = 'store_true' , default = False , help = 'do not display stdout' )
22+ parser .add_argument ('--no-stdout' , action = 'store_true' , default = False , help = 'do not display stderr' )
2023args = parser .parse_args ()
2124
2225def sort_commit_hashes (commits ):
@@ -36,6 +39,10 @@ def sort_commit_hashes(commits):
3639 print ('error: --compact requires --compare' )
3740 sys .exit (1 )
3841
42+ if args .no_stdout and args .no_stderr :
43+ print ('error: cannot specify --no-stdout and --no-stderr at once' )
44+ sys .exit (1 )
45+
3946directory = args .dir
4047input_file = args .infile
4148git_repo = args .repo
@@ -99,7 +106,7 @@ def sort_commit_hashes(commits):
99106
100107 cmd = exe
101108 cmd += ' '
102- if do_compare :
109+ if do_compare and not args . no_quiet :
103110 cmd += ' -q '
104111 if args .debug and Version (version ) >= Version ('1.45' ):
105112 cmd += '--debug '
@@ -121,7 +128,13 @@ def sort_commit_hashes(commits):
121128 p = subprocess .Popen (cmd .split (), stdout = subprocess .PIPE , stderr = subprocess .PIPE , cwd = exe_path , universal_newlines = True )
122129 try :
123130 comm = p .communicate (timeout = args .timeout )
124- out = comm [0 ] + '\n ' + comm [1 ]
131+ out = ''
132+ if not args .no_stdout :
133+ out += comm [0 ]
134+ if not args .no_stderr and not args .no_stderr :
135+ out += '\n '
136+ if not args .no_stderr :
137+ out += comm [1 ]
125138 except subprocess .TimeoutExpired :
126139 out = "timeout"
127140 p .kill ()
0 commit comments