sys.io.Process - can I set the current working directory when starting?

Is there a way to set the current working directory of a sys.io.Process?

I suspect that I can save my main app’s current working directory in a variable with Sys.getCwd(), change it with Sys.setCwd() before starting my sys.io.Process, and then change it back to the original value after starting the process. Does that sound like it will work?

Thanks!

Followup: I confirmed that calling Sys.setCwd() before creating a sys.io.Process instance successfully changes the working directory of the process. Feels hacky, but it works.

However, I wonder if this might have issues in multi-threaded projects where more than one thread might try to call Sys.getCwd() and Sys.setCwd() at the same time.

1 Like