$ echo "thisProcess.nowExecutingPath.postln; 0.exit" >tmp/test.scd
$ sclang tmp/test.scd
... snip...
*** Welcome to SuperCollider 3.13.0. *** For help type ctrl-c ctrl-h (Emacs) or :SChelp (vim) or ctrl-U (sced/gedit).
tmp/test.scd
cleaning up OSC
So at least the path is there.
Also, I had a quick look at the execution path when sclang is given a file to execute. This seems to go into SC_LanguageClient::executeFile() (C++) side, which prepares a statement thisProcess.interpreter.executeFile("your-pathname-here") and runs that.
In the SC classlib, Interpreter:executeFile returns the codeās result but doesnāt print it.
Interpreter:executeFile: no postln
SC_LanguageClient::executeFile: no printf()
SC_TerminalClient (which calls the C++ executeFile): also no printf()
So I canāt figure out why Mac and Win are posting the value automatically, while Linux requires an explicit postln. I donāt see any platform differences in the sourceā¦ unexplained magic.
So this may be another one of those where thereās an optimistic assumption that all platforms should err on the side of more convenience to the user.
In this case, I always took the opposite assumption. Consider:
fork { thisProcess.nowExecutingPath }
This doesnāt print the path, because the Routine isnāt under control of interpretPrintCmdLine. In Terminal, when doing sclang some-path.scd, this is also not under control of interpretPrintCmdLine, so I always assumed that anything I wanted to post, I should post it myself. Iām genuinely surprised to see that Mac and Win seem to be doing extra work that I havenāt been able to find the source code.
Probably the user needs to be added to the āaudioā group, to acquire real-time permission.
I followed your advice and was able to resolve the issue. I sincerely appreciate your guidance.
So I canāt figure out why Mac and Win are posting the value automatically, while Linux requires an explicit postln. I donāt see any platform differences in the sourceā¦ unexplained magic.
Oh, I would like to clarify that there was no mysterious behaviour involved - it was entirely my oversight. When copying, pasting and editing the same code, I accidentally left out the .postln on Linux and mixed up the SCD files between MacOS and Windows. I apologise for any time wasted due to this error. I never noticed/thought I was missing the .postln on Linux.
I have also found that the process of copying, pasting and editing code is very similar to composing a minimalist piece of music, where every detail matters. I realise that I need to focus even more on each element to avoid such mistakes in the future.
Thank you again for your invaluable support and understanding.