[Gambas-user] using 2>redirect with Exec?
brian at westwoodsvcs.com
Sun Aug 8 03:56:54 CEST 2021
I forgot to mention that ' error to' and 'output to' do not redirect the under laying c program outputs on the gambas ones
that is why you need to use the dup2 calls.
"Failure is the key to success;
each mistake teaches us something" .. Morihei Ueshiba
----- On Aug 7, 2021, at 6:39 PM, Brian G <brian at westwoodsvcs.com> wrote:
> Hi bruce,
> Just notices this new thread
> Replied to the other one but here it is again
> Add this to the startup class of you application
> Extern dup2(OldFD As Integer, newfd As Integer) In "libc:6"
> Static Dummy As File
> Static Public Sub _init()
> dummy = Open "/dev/null" For Write
> dup2(dummy.Handle, 1)
> dup2(dummy.handle, 2)
> No need for any other fiddles
> "Failure is the key to success;
> each mistake teaches us something" .. Morihei Ueshiba
> Brian G
> ----- On Aug 7, 2021, at 5:05 PM, Jussi Lahtinen <jussi.lahtinen at gmail.com>
>> No, that is for terminal. You must use "Output to" and "Error To" keywords.
>> [ http://gambaswiki.org/wiki/lang/errorto |
>> http://gambaswiki.org/wiki/lang/errorto ]
>> On Sun, Aug 8, 2021 at 2:29 AM Bruce Steers < [ mailto:bsteers4 at gmail.com |
>> bsteers4 at gmail.com ] > wrote:
>>> I cannot get redirect working with Exec. Is it possible?
>>> Shell "/run/mycommand 2>&1"
>>> works as expected and redirects error text to stdout.
>>> Exec ["/run/mycommand", "2>&1"]
>>> does not redirect and only sends '2>&1' as an argument to /run/mycommand.
>>> Is there a way to redirect with Exec or will i have to Shell it?
>>> For some reason i am under the impression it is better to use Exec over Shell if
>>> Thanks in advance
>>> ----[ [ http://gambaswiki.org/wiki/doc/netiquette |
>>> http://gambaswiki.org/wiki/doc/netiquette ] ]----
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the User