dbschema icon indicating copy to clipboard operation
dbschema copied to clipboard

Difficulties running scripts in headless mode

Open baodrate opened this issue 1 year ago • 0 comments

Running v9.3.0 on Arch Linux with that tar.gz package (but AFAICT these should affect the other Linux packages as well).

  1. the /opt/dbschema/DbSchema script changes the working directory (e.g. cd "$prg_dir"). This means both the -x GROOVY_SCRIPT argument as well as any paths in the actual script itself need to be absolute paths to resolve correctly.
  • I notice old_pwd is set in /opt/dbschema/DbSchema, but it is never restored
  1. Is there a way to pass arguments to the script? I've tried DbSchema -x SCRIPT arg1 arg2 as well as DbSchema -x SCRIPT -args foo bar but as far as I can tell those arguments are not being passed to the actual groovy script. Is this correct?

  2. Execution starts off by printing this to stdout:

DbSchema 9.3.0 build 230415

Execute Script '<SCRIPT_PATH>' as Java Groovy.

  • this makes it harder to write simple scripts that just write to stdout because that preamble needs to be parsed away first. Could these lines be written to stderr instead? Or a command line flag/environment variable that disables it would work too.
  1. The script always exits with 0, even if it exited because of an uncaught exception

baodrate avatar Apr 21 '23 02:04 baodrate