victor9309 commented on PR #683:
URL: https://github.com/apache/flink-web/pull/683#issuecomment-1778542189

   Thanks @XComp for the review. Thank you very much for your advice.
   ```
   $ cat foo-utils.sh 
   function foo() {
     echo 'foo...........' >&2
     exit 1
   }
   $ cat foo-main.sh 
   source ./foo-utils.sh
   
   v=$(foo)
   echo "$v"
   echo "end-------------"
   ```
   
![image](https://github.com/apache/flink-web/assets/18453843/a83ad090-1e5b-4862-8ca1-c9328ebe76dc)
   
   
   I found that exit 1 in the function can not exit the script, so I modify the 
logic, please check it
   ```
   $ cat foo-utils.sh 
   export TOP_PID=$$
   trap 'exit 1' TERM
   function foo() {
      echo 'foo...........' >&2
      kill -s TERM $TOP_PID
   }
   
   $ cat foo-main.sh 
   source ./foo-utils.sh
   
   v=$(foo)
   echo "$v"
   echo "end-------------"
   ```
   
![image](https://github.com/apache/flink-web/assets/18453843/be4816f5-19fb-40ef-9916-6543cb3ba1df)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to