Fixed an issue when invalid CLI command does not return non-zero exit code

This commit is contained in:
Ivan Kravets
2020-02-05 15:31:32 +02:00
parent b83121a951
commit 365c3eaf4b
3 changed files with 5 additions and 3 deletions

View File

@ -32,6 +32,7 @@ PlatformIO Core 4.0
* Fixed default PIO Unified Debugger configuration for `J-Link probe <http://docs.platformio.org/page/plus/debug-tools/jlink.html>`__ * Fixed default PIO Unified Debugger configuration for `J-Link probe <http://docs.platformio.org/page/plus/debug-tools/jlink.html>`__
* Fixed an issue with LDF when header files not found if "libdeps_dir" is within a subdirectory of "lib_extra_dirs" (`issue #3311 <https://github.com/platformio/platformio-core/issues/3311>`_) * Fixed an issue with LDF when header files not found if "libdeps_dir" is within a subdirectory of "lib_extra_dirs" (`issue #3311 <https://github.com/platformio/platformio-core/issues/3311>`_)
* Fixed an issue "Import of non-existent variable 'projenv''" when development platform does not call "env.BuildProgram()" (`issue #3315 <https://github.com/platformio/platformio-core/issues/3315>`_) * Fixed an issue "Import of non-existent variable 'projenv''" when development platform does not call "env.BuildProgram()" (`issue #3315 <https://github.com/platformio/platformio-core/issues/3315>`_)
* Fixed an issue when invalid CLI command does not return non-zero exit code
4.1.0 (2019-11-07) 4.1.0 (2019-11-07)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~

View File

@ -100,8 +100,9 @@ def main(argv=None):
try: try:
configure() configure()
cli() # pylint: disable=no-value-for-parameter cli() # pylint: disable=no-value-for-parameter
except SystemExit: except SystemExit as e:
pass if e.code and str(e.code).isdigit():
exit_code = int(e.code)
except Exception as e: # pylint: disable=broad-except except Exception as e: # pylint: disable=broad-except
if not isinstance(e, exception.ReturnErrorCode): if not isinstance(e, exception.ReturnErrorCode):
maintenance.on_platformio_exception(e) maintenance.on_platformio_exception(e)

View File

@ -69,7 +69,7 @@ def test_library_json_parser():
{"name": "deps2", "version": "https://github.com/username/package.git"}, {"name": "deps2", "version": "https://github.com/username/package.git"},
], ],
"customField": "Custom Value", "customField": "Custom Value",
} },
) )
contents = """ contents = """