GithubHelp home page GithubHelp logo

Comments (5)

bborysenko avatar bborysenko commented on July 27, 2024 1

It looks like that in this case we also have to add import util/log:

++(exception.sh:33): command_not_found_handle(): [[ ls /root2 = \(\ \s\e\t\ \-*\;\ \t\r\u\e* ]]
++(exception.sh:38): command_not_found_handle(): Exception::CustomCommandHandler ls /root2
++(exception.sh:17): Exception::CustomCommandHandler(): return 1
++(exception.sh:38): command_not_found_handle(): true
++(exception.sh:40): command_not_found_handle(): local script=/opt/workflow/bin/wf
++(exception.sh:41): command_not_found_handle(): local lineNo=13
++(exception.sh:42): command_not_found_handle(): local 'undefinedObject=ls /root2'
++(exception.sh:43): command_not_found_handle(): local type=/root2
++(exception.sh:45): command_not_found_handle(): [[ ls /root2 == \(*\) ]]
++(exception.sh:50): command_not_found_handle(): [[ -z ls /root2 ]]
++(exception.sh:55): command_not_found_handle(): [[ 1 -gt 0 ]]
++(exception.sh:57): command_not_found_handle(): subject=level3
++(exception.sh:57): command_not_found_handle(): Log 'inside Try No.: 1'
++(exception.sh:30): command_not_found_handle(): local 'IFS=
'
++(exception.sh:33): command_not_found_handle(): [[ Log inside Try No.: 1 = \(\ \s\e\t\ \-*\;\ \t\r\u\e* ]]
++(exception.sh:38): command_not_found_handle(): Exception::CustomCommandHandler Log 'inside Try No.: 1'
++(exception.sh:17): Exception::CustomCommandHandler(): return 1
++(exception.sh:38): command_not_found_handle(): true
++(exception.sh:40): command_not_found_handle(): local script=/usr/local/lib/bash-oo-framework/util/exception.sh
++(exception.sh:41): command_not_found_handle(): local lineNo=57
++(exception.sh:42): command_not_found_handle(): local 'undefinedObject=Log inside Try No.: 1'
++(exception.sh:43): command_not_found_handle(): local type=/root2
++(exception.sh:45): command_not_found_handle(): [[ Log inside Try No.: 1 == \(*\) ]]
++(exception.sh:50): command_not_found_handle(): [[ -z Log inside Try No.: 1 ]]
++(exception.sh:55): command_not_found_handle(): [[ 1 -gt 0 ]]
++(exception.sh:57): command_not_found_handle(): subject=level3
++(exception.sh:57): command_not_found_handle(): Log 'inside Try No.: 1'
++(exception.sh:30): command_not_found_handle(): local 'IFS=
'

from bash-oo-framework.

indietravel avatar indietravel commented on July 27, 2024

Same issue here with multiple sub-shells spawning unto death.
GNU bash, version 4.3.46(1)-release (x86_64-pc-linux-gnu)

from bash-oo-framework.

niieani avatar niieani commented on July 27, 2024

Thanks for the report (and sorry for the late answer), unfortunately I don't have resources (time) right now to tackle this. If any of you figure this out, please file a PR with the fix or recommendation.

from bash-oo-framework.

niieani avatar niieani commented on July 27, 2024

Could you make a minimal reproduction Dockerfile repository?

from bash-oo-framework.

remipichon avatar remipichon commented on July 27, 2024

Here is a Dockerfile to reproduce the issue

  • Dockerfile
FROM ubuntu

RUN apt-get update && apt-get install -y git

WORKDIR /root
RUN git clone https://github.com/niieani/bash-oo-framework.git

COPY script.sh script.sh
RUN chmod +x script.sh

CMD ["./script.sh"]

# build
# docker build -t test_try_catch .
# run
# docker run test_try_catch
  • script.sh
#!/usr/bin/env bash
source "$( cd "${BASH_SOURCE[0]%/*}" && pwd )/bash-oo-framework/lib/oo-bootstrap.sh"

import util/tryCatch
import util/exception # needed only for Exception::PrintException

# it does work when log are imported
# import util/log

try {
   echo "try"
   exit 1

} catch {
    echo "catch"
    echo "Error in $__EXCEPTION_SOURCE__ at line: $__EXCEPTION_LINE__!"
}
  • build with docker build -t test_try_catch .
  • test with docker run test_try_catch
  • it will exhaust your cpu so docker kill might help
  • uncomment line 8 of script.sh to have it working

Hope this helps, thanks !

from bash-oo-framework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.