Set node stack and string properties via rvpush on initial startup

I’m currently running a subprocess to open rv for a specific tag. The problem is that I’d like to open this session with a specific node stack type and add some string properties.

I can create this command like so:

cmd = f"rvpush -tag {tag} merge {path}"
cmd += f"; sleep 7; rvpush -tag {tag} py-eval \"rv.commands.setViewNode('master')\""
cmd += f"; rvpush -tag {tag} py-eval \"[rv.commands.setStringProperty(f'{{stack}}.composite.type', ['replace'], True) for stack in rv.commands.nodesOfType('RVStack')]\""

# Run the cmd here via subprocess
proc = subprocess.Popen(cmd)

and use a custom sleep to wait for RV to start. But this can differ for my users, eg how long it takes for rv to start – so it’s a bit hacky.

Are there any way to open rv with certain settings programmatically like this without relying on a sleep to wait for the rv session to start?

on linux at least, there is a little file that is added by rv when it gets a port. Look here:
When your first instance of rv acquires a port, it writes the file there, named with the process ID, containing the port number. I’m pretty sure you are safe to do your next push once the file shows up.

Is this something you are able to control the install of RV for?

If so, it might be more beneficial to use the -sendEvent and write a package that responds to that event.

This will send the event with the payload you provide, with external- prepended to the event name; and it will be called once RV is properly started up. It also allows you to do much more complicated logic for additional checks as you see fit; since you don’t have to embed python/mu into your commandline, wait on sleeps sending random commands, etc.