daneyul <
dane...@gmail.com> wrote:
> Can anyone shed any light on why:
>
> exec system_profiler
Does OSX have an strace command (or the fancier BSD 'tracing' command
of which I don't remember the name because I don't have a BSD or Mac
system)?
If yes to either, you could try tracing the exec and see what is
happening on a very low level (and sometimes this sheds light on a
cause).
> "Open |[list system_profiler]" also fails (immediate EOF) on 10.11,
> but works on the other systems. (Just running system_profiler in a
> bash terminal works fine.)
This implies that something is different in the environment underwhich
system_profiler is run between launching it from Tcl vs. launching it
from bash (i.e., one or more environment variables it uses are present
under bash, but not under Tcl's exec).
This effect you describe here is quite common with Cron jobs, where a
script works perfectly called from a user session from bash, but fails
when run as a cron job, because the PATH or some other environment
variable is different under both.
Figuring out which can be a pain sometimes, although differences in the
PATI variable would be the first suspect to investigate.
You could try using bash from Tcl to launch it, launch bash with the -c
option and then the command:
bash -c system_profiler
or
/bin/bash -c /usr/bin/system_profiler
Change /bin/ and /usr/bin/ to the actual disk locations on OSX for
either.