Re: [Nix-dev] wrapProgram: also pass name as NIX_PROGRAM_NAME

2017-05-22 Thread Graham Christensen
I think it is worth investigating using C or something for wrappers, as wrappers on macOS can't be used in shebangs. Wrapped ruby executables have to be unwrapped to use. Would using C solve your problems as well? On Mon, May 22, 2017 at 11:00 AM Freddy Rietdijk wrote:

Re: [Nix-dev] wrapProgram: also pass name as NIX_PROGRAM_NAME

2017-05-22 Thread Freddy Rietdijk
> > The problem with such an environment variable is that it's inherited by > child > processes, who might get confused. (E.g. some code might run both in a > wrapped > and unwrapped context, so it wouldn't be able to rely on $NIX_PROGRAM_NAME > unambiguously.) In the case of Python we might be

Re: [Nix-dev] wrapProgram: also pass name as NIX_PROGRAM_NAME

2017-05-22 Thread Freddy Rietdijk
If a Python script is run, then `sys.argv[0]` is set to the script name (or path, depending on platform). Some scripts use this name or path to start a new instance of itself. Unfortunately, exec -a doesn't set `sys.argv[0]`. Therefore, when running a wrapped Python script, `sys.argv[0]` points

[Nix-dev] wrapProgram: also pass name as NIX_PROGRAM_NAME

2017-05-19 Thread Freddy Rietdijk
Hi, When we create a wrapper we use `exec -a` so that the wrapped program uses the name of the original program. This isn't respected by all programs, e.g. Python ignores this. If I am correct this is the case with all interpreters. How do we handle this with other interpreters? Currently we