FHIR Chat · Unix Gurus please · committers

Stream: committers

Topic: Unix Gurus please


view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:05):

I am trying to get the IG publisher to run on MacOS under the Eclipse interactive debugger.

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:06):

this proves to be super painful.

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:06):

after much mucking around, I finally have jekyll executing.

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:06):

This in itself is a massive victory

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:07):

to get it to execute I have to run the java ProcessBuilder and pass in a modified path that references the ruby and jekyll executables, and then pass the command:

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:08):

bash -c jekyll build --destination "/Users/grahamegrieve/temp/igs/swissnoso/output"

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:08):

this correctly runs jekyll (yay!) but jekyll doesn't get any of the parameters after "jekyll" - I get the message A subcommand is required

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:09):

this doesn't appear to be consistent with the documentation for bash -c:

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:09):

-c string If the -c option is present, then commands are read from
string. If there are arguments after the string, they are
assigned to the positional parameters, starting with $0.

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:11):

have i missed something? Or is OSX the problem here (I'm amazed at how resistant OSX is to things like environment variables)

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:20):

if I omit the bash -c bit then jekyll doesn't run at all, even though jekyll is in the path

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:21):

presumably because it's not an executable, but some shell trick thing

view this post on Zulip Elliot Silver (Feb 09 2022 at 22:28):

FWIW, I was able to get IG publisher running on mac from inside the VS Code debugger.

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:29):

how?

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:29):

I think that's the same problem

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:29):

I have sushi running - that was a little work with paths.

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:29):

but jekyll has proven harder

view this post on Zulip Elliot Silver (Feb 09 2022 at 22:31):

Hmm, I don't think it was hard -- it was back when I was trying to debug the locale warning about two months ago.

view this post on Zulip Elliot Silver (Feb 09 2022 at 22:32):

I need to run out. I'll try to get you more when I get back.

view this post on Zulip Jens Villadsen (Feb 09 2022 at 22:34):

Aren't you missing some single ''s?

view this post on Zulip Jens Villadsen (Feb 09 2022 at 22:34):

eg. bash -c 'jekyll build --destination "/Users/grahamegrieve/temp/igs/swissnoso/output"'

view this post on Zulip Oliver Egger (Feb 09 2022 at 22:35):

i can run on osx eclipse ig publisher with no sushi in progrma arguments:: -ig ig.ini -jekyll /usr/local/bin/jekyll -no-sushi

view this post on Zulip Oliver Egger (Feb 09 2022 at 22:36):

never managed till now to get sushi running, but never wanted to debug that, just run sushi standalone before as a workaround

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:38):

if I try bash -c 'jekyll build --destination "/Users/grahamegrieve/temp/igs/swissnoso/output"'

then I get the error that the file jekyll build --destination "/Users/grahamegrieve/temp/igs/swissnoso/output" can't be found

view this post on Zulip Jens Villadsen (Feb 09 2022 at 22:38):

and why the "?

view this post on Zulip Jens Villadsen (Feb 09 2022 at 22:39):

what happens if you remove those?

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:43):

in case there's spaces - some IG authors like to do that. But I don't, and removing them didn't help

view this post on Zulip Jens Villadsen (Feb 09 2022 at 22:44):

sure - ... but now it sounds like that destination actually does not exist then

view this post on Zulip Jens Villadsen (Feb 09 2022 at 22:45):

wait ....

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:46):

jekyll and the output directory exist, but 'jekyll build --destination "/Users/grahamegrieve/temp/igs/swissnoso/output"' doesn't, because it's not a path

view this post on Zulip Jens Villadsen (Feb 09 2022 at 22:46):

correct

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:47):

interesting - this doesn't work in terminal:

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:47):

➜  ~ bash -c jekyll build --destination /Users/grahamegrieve/temp/igs/swissnoso/output
A subcommand is required.
jekyll 4.2.1 -- Jekyll is a blog-aware, static site generator in Ruby

view this post on Zulip Oliver Egger (Feb 09 2022 at 22:50):

i get with bash and zsh a little bit further:

view this post on Zulip Oliver Egger (Feb 09 2022 at 22:50):

bash -c 'jekyll build --destination "/Users/oliveregger/Documents/github/ch-emed/output"'
Configuration file: none
Source: /Users/oliveregger/Documents/github/ch-emed
Destination: /Users/oliveregger/Documents/github/ch-emed/output
Incremental build: disabled. Enable with --incremental
Generating...
Liquid Exception: Could not locate the included file 'fragment-pagebegin.html' in any of ["/Users/oliveregger/Documents/github/ch-emed/_includes"]. Ensure it exists in one of those directories and, if it is a symlink, does not point outside your site source. in temp/pages/Binary-2-6-pdf.change.history.html

view this post on Zulip Oliver Egger (Feb 09 2022 at 22:51):

what kind of jekyll version do you have? i have 4.1.1

view this post on Zulip Oliver Egger (Feb 09 2022 at 22:52):

ouh, you are even i a never version then i am, sorry

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:57):

yes that works in terminal for me too

view this post on Zulip Grahame Grieve (Feb 09 2022 at 22:59):

but not in process builder, where I still get the error Jekyll: bash: jekyll build --destination /Users/grahamegrieve/temp/igs/swissnoso/output: No such file or directory

view this post on Zulip Grahame Grieve (Feb 09 2022 at 23:25):

https://stackoverflow.com/questions/71058046/running-jekyll-from-java-program-under-eclipse-on-osx

view this post on Zulip Vassil Peytchev (Feb 10 2022 at 18:07):

Have you tried putting the command line in a bash script and execute that?

view this post on Zulip Grahame Grieve (Feb 10 2022 at 19:39):

no. I haven't. I suppose I'll try that. Super annoying and makes me worry about security surprises.

view this post on Zulip Jens Villadsen (Feb 10 2022 at 21:18):

I found your solution @Grahame Grieve : https://stackoverflow.com/a/41159427/2248883

view this post on Zulip Jens Villadsen (Feb 10 2022 at 21:19):

    String myActualCommand =
        "sushi -v";

// able to execute arbitrary shell command sequence
    CommandLine shellCommand = new CommandLine("bash").addArgument("-c");

// set handleQuoting = false so our command is taken as it is
    shellCommand.addArgument(myActualCommand, false);

works like a charm

view this post on Zulip Vassil Peytchev (Feb 10 2022 at 21:23):

I thought the problem was that jeckyl was not running, not sushi?

view this post on Zulip Vassil Peytchev (Feb 10 2022 at 21:26):

If it is jeckyl, it could be an issue with missing environment variables that are needed to properly interpret a Ruby GEM as an executable...

view this post on Zulip David Otasek (Feb 10 2022 at 21:42):

I did notice that this is using bash. By default, new macs are running zsh. If jeckyl needs environment variables, they may have been configured in zsh instead of bash.

view this post on Zulip Grahame Grieve (Feb 10 2022 at 21:49):

if it makes any difference, I haven't found it. I've alternated zsh and bash in my testing

view this post on Zulip David Otasek (Feb 10 2022 at 21:51):

It was worth a shot.

view this post on Zulip Grahame Grieve (Feb 10 2022 at 21:59):

@Vassil Peytchev there certainly is a problem with the path environment variable (what a mess it is in unix, let alone OSX, which is specially woeful on this). But that's not the problem - it's the intersection of Java invocation, the way the shell works, and using symlinks to shell scripts in a chain to launch ruby code

view this post on Zulip Grahame Grieve (Feb 10 2022 at 22:02):

@Jens Villadsen that does solve it nicely - thanks very much

view this post on Zulip Jens Villadsen (Feb 10 2022 at 22:04):

Np

view this post on Zulip Grahame Grieve (Feb 10 2022 at 22:33):

https://confluence.hl7.org/display/FHIR/Using+fhir-tool-settings.conf

these will not generally be needed by ordinary users, but will probably be needed if you are working on Unix / OSX and launching the IG publisher or the validator from somewhere other than the shell (might not be - this is unpredictable). Some of them will be needed if you are working with the fhir test cases using the java tooling


Last updated: Apr 12 2022 at 19:14 UTC