scsh-users
[Top] [All Lists]

Re: Output to control terminal

To: RT Happe <rthappe@mathematik.uni-freiburg.de>
Subject: Re: Output to control terminal
From: Martin Gasbichler <gasbichl@informatik.uni-tuebingen.de>
Date: Mon, 15 Jul 2002 09:42:50 +0200
Cc: <scsh-bugs@zurich.ai.mit.edu>
Sender: gasbichl@informatik.uni-tuebingen.de
>>>>> "RT" == RT Happe <rthappe@mathematik.uni-freiburg.de> writes:

RT> I cannot write to the control terminal opened as input file, then dupped.
RT> [ Linux PC, kernel 2.2.17 ]
RT> Welcome to scsh 0.6.2 (Gambit-C 4.0) Type ,? for help.
>> (close-after (dup->outport (open-input-file (control-tty-file-name)))
RT>            (lambda (op) (display 'beep op)))
RT> Error: exception
RT>        os-error
RT>        (channel-maybe-write '#{Byte-vector 98 101 101 112 0 0 ---} 0 4
RT> '#{Output-channel 4} "Bad file descriptor")


You have to open the file in read/write mode if you want to use it for
input and output as well:

(close-after (dup->outport (open-file (control-tty-file-name) open/read+write))
   (lambda (op) (display 'beep op)))


-- 
Martin

<Prev in Thread] Current Thread [Next in Thread>