|
From: | Barath Aron |
Subject: | Re: Introduce posix_spawn |
Date: | Fri, 7 Sep 2018 06:37:05 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
On 9/7/18 4:54 AM, Dale R. Worley wrote:
Couldn't you change the w.d. to the correct target, spawn, and then change the w.d. back?
Yes, one could do this.
Do you know systems that have this program? What is the name of this utility program?Alternatively, one could direct the spawned process to run a program that would set the working directory to, say, the first argument, and then use the remaining arguments to run/fork/spawn the target program.
Indeed, I would expect Threos to have a system program to do exactly this, since other people must have seen the same problem.
Actually, this particular problem can be easily solved on Threos, because the posix_spawn() API offers a function for this: int posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t* __restrict file_actions, const char* __restrict path);
Note the "np" at the end, it means "non portable". I also found references on Oracle's webpage [1].
Aron[1] https://docs.oracle.com/cd/E86824_01/html/E54766/posix-spawn-file-actions-addchdir-np-3c.html
[Prev in Thread] | Current Thread | [Next in Thread] |