Proper command format to disassociate from terminal?

When launching my snap from the terminal, I need the user to be able to close the terminal window without it stopping the snap app from running.

In core18 I would use a command ending with an ampersand like this in YAML:
desktop-launch python3 $SNAP/ &

But core20 won’t allow the ampersand & at the end, which is how I disassociate the terminal command from the terminal session when launching the app.

How should I accomplish this same goal in core20?

Some people call it “running in the background,” or “spawning,” or “detaching the process.”

Thanks in advance!

i never tried this, but perhaps you could ship nohup (from the coreutils package) in your snap and prefix your command with it ?

Any idea how one would add nohup in such a way that it will actually compile the snap? I’m running python 3.6.9 if that matters.

I initially tried just adding it to the command, but got this error while snapping:

The specified command 'nohup desktop-launch python3 $SNAP/' defined in the app does not exist.

I tried adding coreutils to stage-packages and also to build-packages, but got the same error.

I tried adding coreutils to requirements.txt and got these two errors:

ERROR: Could not find a version that satisfies the requirement coreutils (from -r /root/project/requirements.txt (line 1)) (from versions: none)

ERROR: No matching distribution found for coreutils (from -r /root/project/requirements.txt (line 1))

Thanks to anyone with a suggestion!

stage-packages should be enough to get it into your snap, i think you need to recraft your command: and use full paths for everything after nohup … or switch to using command-chain …