1 |
578 |
markom |
'\"
|
2 |
|
|
'\" Copyright (c) 1993 The Regents of the University of California.
|
3 |
|
|
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
|
4 |
|
|
'\"
|
5 |
|
|
'\" See the file "license.terms" for information on usage and redistribution
|
6 |
|
|
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
7 |
|
|
'\"
|
8 |
|
|
'\" RCS: @(#) $Id: close.n,v 1.1.1.1 2002-01-16 10:25:24 markom Exp $
|
9 |
|
|
'\"
|
10 |
|
|
.so man.macros
|
11 |
|
|
.TH close n 7.5 Tcl "Tcl Built-In Commands"
|
12 |
|
|
.BS
|
13 |
|
|
'\" Note: do not modify the .SH NAME line immediately below!
|
14 |
|
|
.SH NAME
|
15 |
|
|
close \- Close an open channel.
|
16 |
|
|
.SH SYNOPSIS
|
17 |
|
|
\fBclose \fIchannelId\fR
|
18 |
|
|
.BE
|
19 |
|
|
|
20 |
|
|
.SH DESCRIPTION
|
21 |
|
|
.PP
|
22 |
|
|
Closes the channel given by \fIchannelId\fR. \fIChannelId\fR must be a
|
23 |
|
|
channel identifier such as the return value from a previous \fBopen\fR
|
24 |
|
|
or \fBsocket\fR command.
|
25 |
|
|
All buffered output is flushed to the channel's output device,
|
26 |
|
|
any buffered input is discarded, the underlying file or device is closed,
|
27 |
|
|
and \fIchannelId\fR becomes unavailable for use.
|
28 |
|
|
.VS "" br
|
29 |
|
|
.PP
|
30 |
|
|
If the channel is blocking, the command does not return until all output
|
31 |
|
|
is flushed.
|
32 |
|
|
If the channel is nonblocking and there is unflushed output, the
|
33 |
|
|
channel remains open and the command
|
34 |
|
|
returns immediately; output will be flushed in the background and the
|
35 |
|
|
channel will be closed when all the flushing is complete.
|
36 |
|
|
.VE
|
37 |
|
|
.PP
|
38 |
|
|
If \fIchannelId\fR is a blocking channel for a command pipeline then
|
39 |
|
|
\fBclose\fR waits for the child processes to complete.
|
40 |
|
|
.VS "" br
|
41 |
|
|
.PP
|
42 |
|
|
If the channel is shared between interpreters, then \fBclose\fR
|
43 |
|
|
makes \fIchannelId\fR unavailable in the invoking interpreter but has no
|
44 |
|
|
other effect until all of the sharing interpreters have closed the
|
45 |
|
|
channel.
|
46 |
|
|
When the last interpreter in which the channel is registered invokes
|
47 |
|
|
\fBclose\fR, the cleanup actions described above occur. See the
|
48 |
|
|
\fBinterp\fR command for a description of channel sharing.
|
49 |
|
|
.PP
|
50 |
|
|
Channels are automatically closed when an interpreter is destroyed and
|
51 |
|
|
when the process exits. Channels are switched to blocking mode, to ensure
|
52 |
|
|
that all output is correctly flushed before the process exits.
|
53 |
|
|
.VE
|
54 |
|
|
.PP
|
55 |
|
|
The command returns an empty string, and may generate an error if
|
56 |
|
|
an error occurs while flushing output.
|
57 |
|
|
|
58 |
|
|
.SH KEYWORDS
|
59 |
|
|
blocking, channel, close, nonblocking
|