2018-01-14 12:00 GMT+01:00 Catonano <[email protected]>:

> Hi Danny,
>
> thanks for your help
>
>
> 2018-01-14 11:43 GMT+01:00 Danny Milosavljevic <[email protected]>:
>
>> Hi Catonano,
>>
>> On Sun, 14 Jan 2018 08:21:10 +0100
>> Catonano <[email protected]> wrote:
>>
>>
> Ah, the spaces :-/
>
>
>>
>> TRYTOPASSILE = /gnu/store/some-hash-passfile
>>             ^ ^
>>
>> You'd need to remove those.  But even better instead do the following:
>>
>> I'd just call (setenv "/gnu/store/some-hash-passfile") instead of
>> starting a whole shell (it's a waste and increases the attach surface for
>> no reason to use a shell here).
>>
>
> I can certainly do like you suggest. It's cleaner
>
>
With this form

(primitive-exit
 (begin
    (setenv "TRYTONPASSFILE" #$passfile)
    (invoke
       run-the-trytond-init-script
       trytond-initscript-args
       )))

I get this error

ERROR: In procedure primitive-exit:
ERROR: Wrong type (expecting exact integer): #t

While with this version

(primitive-exit
  (setenv "TRYTONPASSFILE" #$passfile)
  (invoke
     run-the-trytond-init-script
     trytond-initscript-args
     )))

I get an error claiming a wrong number of arguments passed to primitive-exit


Finally, with hthis version

          (match (primitive-fork)
             (0
              ;; Exit with a non-zero status code if an exception is thrown.
              ;; why don't we use a try/catch ? Boh
              (dynamic-wind
                (const #t)
                (lambda ()
                  (setgid (passwd:gid trytond-user))
                  (setuid (passwd:uid trytond-user))
                  (setenv "TRYTONPASSFILE" #$passfile)
                  (primitive-exit
                   (invoke
                    run-the-trytond-init-script
                    trytond-initscript-args;; THIS IS A LIST, NOT A STRING
                    )))
                (lambda ()
                  (primitive-exit 1))))
             (pid (waitpid pid)))))))))


I get

ERROR: In procedure primitive-exit:
ERROR: Wrong type (expecting exact integer): #t

isn't invoke returning an exact integer ?
Maybe tryton-admin insn't seeing the env var and promtping to ask for its
interaction ?


How am I supposed to use setenv, exactly ?

Thanks

Reply via email to