bodo-hugo-barwich / Process

Perl Module for Multiprocessing
Other
1 stars 2 forks source link

Script for Bash Integration #34

Closed bodo-hugo-barwich closed 1 year ago

bodo-hugo-barwich commented 1 year ago

For automation purposes a script is needed which captures the outputs and separates them correctly which enables advanced processing in automations

bodo-hugo-barwich commented 1 year ago

To avoid the abrupt exit without any activity information and build a shortcut for:

cpan-upload ${{ steps.build_release.outputs.file }} 2>cpan-upload_error.log > cpan-upload.log || echo "Exit Code: '$?'" >> cpan-upload.log
publish_res=`cat cpan-upload.log | grep -i "exit code:" | cut -d"'" -f2` 
if [ -z "$publish_res" ]; then publish_res=0; echo "Exit Code: '0'" >> cpan-upload.log; fi;
duplicated=`cat cpan-upload_error.log | grep -i "Conflict" | wc -l`
echo "CPAN Upload Report:"
cat cpan-upload.log
echo "CPAN Upload Error:"
cat cpan-upload_error.log
if [ $duplicated -ne 1 ]; then exit $publish_res ; fi;

a script is needed which enables the postprocessing and alternative existing without ignoring all errors but selectively discard certain errors or recover from them.

bodo-hugo-barwich commented 1 year ago

For the sake of easy automated processing there will be different output formats of the command execution results:

bodo-hugo-barwich commented 1 year ago

the Runner Script bin/run_subprocess.pl will accept different Options to be passed to the Process::SubProcess obejct as parameters:

Mandatory parameter 'command' missing in call to "eval"

run_subprocess.pl [-bcdfhnrtx] [long options...]
    -c STR --command STR      the COMMAND to be run
    -n STR --name STR         the NAME for the COMMAND
    -r INT --readtimeout INT  the TIMEOUT for reading of the output from
                              COMMAND
    -t INT --timeout INT      the TIMEOUT for execution the COMMAND
    -x --exit                 execution returns exit code
    -f STR --format STR       the format for the output
    -b STR --boundary STR     boundary string for the plain text output
    -d --debug                execution debug output
    -h --help                 print usage message and exit
Runner Result:
''
Runner EXIT CODE: '255'
bodo-hugo-barwich commented 1 year ago

This behaviour is thoroughly tested with the new t/test_runner.t test.

bodo-hugo-barwich commented 1 year ago

This feature becomes available with the Process::SubProcess version v2.1.0