Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subprocess run with ignored non-zero exit #325

Open
philipjonsen opened this issue Mar 12, 2023 · 0 comments
Open

Subprocess run with ignored non-zero exit #325

philipjonsen opened this issue Mar 12, 2023 · 0 comments

Comments

@philipjonsen
Copy link

DESCRIPTION
subprocess.run uses a default of check=False, which means that a nonzero exit code will be ignored by default, instead of raising an exception.

You can ignore this issue if this behaviour is intended.

BAD PRACTICE

Nonzero exit code will be ignored here

subprocess.run(['notify-send', '-u', 'critical', msg])
RECOMMENDED

Exception will be raised for nonzero exit code

subprocess.run(['notify-send', '-u', 'critical', msg], check=True) # some comment

Using subprocess.run without explicitly set check is not recommended.

scripts/verify.py

53 exit('contract name not found.')
54
55print('Obtaining chain... ')
56seth_chain = subprocess.run(['seth', 'chain'], capture_output=True)
57chain = seth_chain.stdout.decode('ascii').replace('\n', '')
58print(chain)
59

Using subprocess.run without explicitly set check is not recommended.

scripts/verify.py

74action = 'verifysourcecode'
75code_format = 'solidity-single-file'
76
77flatten = subprocess.run([
78 'hevm',
79 'flatten',
80 '--source-file',

Using subprocess.run without explicitly set check is not recommended.

archive/2022-12-09-DssSpell/scripts/verify.py

74action = 'verifysourcecode'
75code_format = 'solidity-single-file'
76
77flatten = subprocess.run([
78 'hevm',
79 'flatten',
80 '--source-file',

Using subprocess.run without explicitly set check is not recommended

archive/2022-12-09-DssSpell/scripts/verify.py

53 exit('contract name not found.')
54
55print('Obtaining chain... ')
56seth_chain = subprocess.run(['seth', 'chain'], capture_output=True)
57chain = seth_chain.stdout.decode('ascii').replace('\n', '')
58print(chain)
59

scripts/verify.py

53 exit('contract name not found.')
54
55print('Obtaining chain... ')
56seth_chain = subprocess.run(['seth', 'chain'], capture_output=True)
57chain = seth_chain.stdout.decode('ascii').replace('\n', '')
58print(chain)
59

Using subprocess.run without explicitly set check is not recommended.
scripts/verify.py

74action = 'verifysourcecode'
75code_format = 'solidity-single-file'
76
77flatten = subprocess.run([
78 'hevm',
79 'flatten',
80 '--source-file',

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant