[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 'system': bug or misunderstanding?
From: |
clerke |
Subject: |
Re: 'system': bug or misunderstanding? |
Date: |
Sat, 5 Jan 2008 02:05:49 +0400 |
User-agent: |
KMail/1.9.7 |
On Friday 04 January 2008 22:29:01 John W. Eaton wrote:
> On 1-Jan-2008, clerke wrote:
> | Shouldn't these two commands both send 'foo' back to my screen?
> | (Octave 3.0.0 on gentoo/amd64, but I noticed it in earlier Octave
> | versions too).
> |
> | octave:1> system ("echo foo; exit 2",1,"async")
> | ans = 829
> | octave:2> foo
> |
> | octave:2> system ("echo foo; exit 2",1,"sync")
> | ans = 2
> | octave:3>
> | octave:3>
> |
> | In particular, i would have thought the sync version should do it.
>
> No, the sync version should return the output from the system command
> (you specified that with the second argument of 1):
ok, I see now that 'return_output' means to redirect stdout to the second
output variable. If that's not there (as in my tests above) it just gets lost
in the sync case.
I'll see if I can make sense of it with some experimentation.
> octave:1> [status, output] = system ("echo foo; exit 2",1,"sync")
> status = 2
> output = foo
>
> This is documented, though I suppose not very clearly. I would
> welcome a patch that improved the doc string.
ok.
I'll see if I can come up with some useful patches after some experimentation
with system and edit.
> | Sooo...am i totally misunderstanding how system should work?
> | And either way, how do I get 'edit' to work?
>
> If your problem is with edit, then how about sending a precise recipe
> for duplicating the problem your are having with it?
Thought I already did.
i type 'edit foo' at the octave prompt, and the prompt doesn't return.
However, 'ctrl-x' (the normal way to exit nano) makes the octave prompt
return.
Nano actually started (and i could probably edit blindly), but I don't see the
screen display from it. This seemed to be something to do with the way edit.m
uses system as above, but now I'm not so sure because ...
I have a new bit of information now: when I set the editor to vim, i get a
message saying 'Vim: Warning: Output is not to a terminal', and it behaves as
for nano.
I get this message (and the same behaviour) whether I work in kdevelop,
koctave, konsole terminal emulator, or even a basic console tty.
It's starting to sound like 'not our problem', i guess, but I *can* get vim to
work outside octave with no trouble.
Is 'edit' even designed to work with these screen editors, or is it only for
line editors?
> jwe
wayne