Launching script with custom command from macOS terminal

Hello,

I’m trying to launch a custom command from a shell script in macOS for CD/CI and testing purposes.

In this thread I see an example of how to start a script on a Mac:

/Applications/Rhino\ 8.app/Contents/MacOS/Rhinoceros ~/Desktop/yourfile.3dm -runscript "_Line 0 10,10,10"

and this actually works for me.
But what if I want to invoke a custom command I implemented in my plugin, instead of a Rhino command like _Line?

In the specific case, my command expects two string arguments (representing respectively a path to a file and a path to a directory).

Example:

/Applications/Rhino\ 8.app/Contents/MacOS/Rhinoceros <path_to_3dm_file> -runscript "_-JT_TestSuite <path_to_file> <path_to_dir>"

but once the command is started, the following arguments are interpreted as new commands and Rhino responds with an “Unknown command”.

So what’s happening “behind the hood” in a Rhino command that differs form a custom command?
It seems like _Line is able to capture args, while my _JT_TestSuite command isn’t.

(NOTE: paths I provide as args do not contain spaces)

There may be a bug here, I need to test this on my end. However, I do notice that you have a second underscore between JT and TestSuite which might be throwing off the parsing of the Macro. What happens if you remove that second underscore by renaming your command JTTestSuite?

Hi @dan thanks for the quick reply.

I tried renaming the command to JTTestSuite but the arguments are not recognised nonetheless.
Please let me know if you find out something on your side.

Thanks for testing that. I’ll see if I can reproduce this an report back here.

This is weird and I haven’t figured it out yet, but I can reproduce what you’re seeing. As I debug this, I’m going down quite a rabbit-hole.

In the meantime, try this: make your JT_TestSuite command a script runner command. With my test-harness, this dodged the bug. I don’t know why …yet…and it feels a little nonsensical.

:backhand_index_pointing_up: actually looks like this is wrong, unfortunately. I think there must be a race-condition somewhere in our script parsing code. Sometimes running my test-harness works, sometimes it does not. I’ll keep looking.

I logged a bug for this here:

RH-94277 RunScript: CLI runscript does not always parse custom command options

1 Like

Good to know, thanks. :+1:
While the bug is being fixed, I’ll try to find a workaround.

It is a drag, and I apologize.

For CI, I have found that this works:
--runscript "-_RunPythonScript /path/to/your/test-script.py"
but it likely requires you rethinking where you put your test logic, which is not ideal.

1 Like

Thanks @dan I’ll take that into account.