[haiku-bugs] Re: [Haiku] #12298: Running shell commands from an app fails

  • From: "ttcoder" <trac@xxxxxxxxxxxx>
  • Date: Thu, 20 Aug 2015 11:09:31 -0000

#12298: Running shell commands from an app fails
-------------------------------------+----------------------------
Reporter: humdinger | Owner: axeld
Type: bug | Status: new
Priority: blocker | Milestone: R1/beta1
Component: Servers/launch_daemon | Version: R1/Development
Resolution: | Keywords:
Blocked By: | Blocking:
Has a Patch: 0 | Platform: All
-------------------------------------+----------------------------

Comment (by ttcoder):

Oddities when I do a test with printf():

stdio.h (and the man page) define printf() as returning the number of
bytes written ''or an error code'', but it never returns an error here, in
Terminal or Tracker.

Also tried to dump `stdout` (which is a `FILE *`) using a BAlert, but it
always has an ex value/address, regardless of context (and the address
changes at each invokation for that matter). Dunno if it's normal that
`FILE * stdout` is "valid" in both contexts, in the 'raw' C++ code, but
when said C++ code invokes `system()` to call a command, said command no
longer has an stdout.. Maybe the standard lib's FILE * is just a wrapper
around something else anyway.

Beside the stdlib, I also played with POSIX `open()`:

{{{
int res = open("/boot/home/test", O_RDONLY)
}}}

and the result is surprising: when run from a Terminal, I get the expected
file descriptor value 3, meaning that 0 1 and 2 are already reserved, as
expected.

When run from Tracker I get... If you said "0" you're wrong -- I get
'''10''' !

WTH?? :-b

--
Ticket URL: <https://dev.haiku-os.org/ticket/12298#comment:17>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: