Comments (5)
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.
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.
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.
Could you make a minimal reproduction Dockerfile repository?
from bash-oo-framework.
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)
- Is the project dead? HOT 3
- Sorry, a bit cheeky/impolite... HOT 2
- error handling with throw / command_not_found_handle HOT 3
- Unbound variables cause a crash when running examples with 'set -u' HOT 3
- [bug?] `throw` is said to be 'undefined command' when `import` fail HOT 5
- Catch exception from Classes doesn't work HOT 7
- Inconsistent array assignments HOT 3
- Translating README into Japanese
- for people who want to use Bpkg to install this framework HOT 1
- example/trycatch.sh doesn't work as expected
- Make wiki page
- [Question] Does value of '__primitive_extension_fingerprint' have special meaning?
- update readme instructions for namedParameters
- util/exception.sh shows stack trace as expected but don't exit on Ctrl+C HOT 2
- False boolean not working HOT 1
- Referring this in Human example class doesn't work as described HOT 1
- Exception messages are invisible in light theme mode in Shell console.
- [Question] Is this project still alive? HOT 6
- [Discussion] Log API
- Using a variable for an Object name
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bash-oo-framework.