commit/galaxy-central: jmchilton: Fix stdio return code handling that has been broken for a few releases.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/9b738973adaf/ Changeset: 9b738973adaf User: jmchilton Date: 2013-10-09 19:48:26 Summary: Fix stdio return code handling that has been broken for a few releases. Affected #: 1 file diff -r 50f5157b063f5567fa2cea820d85bb4abd233f91 -r 9b738973adafffa45605e2c27ecb769ea21e8d94 lib/galaxy/jobs/runners/__init__.py --- a/lib/galaxy/jobs/runners/__init__.py +++ b/lib/galaxy/jobs/runners/__init__.py @@ -167,16 +167,28 @@ if job_wrapper.dependency_shell_commands: commands = "; ".join( job_wrapper.dependency_shell_commands + [ commands ] ) + # Coping work dir outputs or setting metadata will mask return code of + # tool command. If these are used capture the return code and ensure + # the last thing that happens is an exit with return code. + capture_return_code_command = "; return_code=$?" + captured_return_code = False + # Append commands to copy job outputs based on from_work_dir attribute. if include_work_dir_outputs: work_dir_outputs = self.get_work_dir_outputs( job_wrapper ) if work_dir_outputs: + if not captured_return_code: + commands += capture_return_code_command + captured_return_code = True commands += "; " + "; ".join( [ "if [ -f %s ] ; then cp %s %s ; fi" % ( source_file, source_file, destination ) for ( source_file, destination ) in work_dir_outputs ] ) # Append metadata setting commands, we don't want to overwrite metadata # that was copied over in init_meta(), as per established behavior if include_metadata and job_wrapper.requires_setting_metadata: + if not captured_return_code: + commands += capture_return_code_command + captured_return_code = True commands += "; cd %s; " % os.path.abspath( os.getcwd() ) commands += job_wrapper.setup_external_metadata( exec_dir = os.path.abspath( os.getcwd() ), @@ -185,6 +197,11 @@ output_fnames = job_wrapper.get_output_fnames(), set_extension = False, kwds = { 'overwrite' : False } ) + + + if captured_return_code: + commands += '; sh -c "exit $return_code"' + return commands def get_work_dir_outputs( self, job_wrapper ): Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org