For us it has always been easy to do with minimal code. This solution works in both the main and render processes.
Our main process checks with the following:
For this we purposely only look for it as the 3rd argv. If your launch script has multiple flags you might have to adjust the specific argv it is looking at. If you want a packaged binary to run this way or make it agnostic to it's placement you best make it loop through process.argv looking for a match.