public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* stdout/stderr handling by cygrunsrv/bash/tcl
@ 2004-03-02 16:36 Patrick Samson
  2004-03-02 19:27 ` Igor Pechtchanski
  0 siblings, 1 reply; 7+ messages in thread
From: Patrick Samson @ 2004-03-02 16:36 UTC (permalink / raw)
  To: cygwin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 727 bytes --]

I run a service installed as:

cygrunsrv --install pgr-daemon
 --path /usr/bin/bash.exe
 --args "--login /opt/pgreplica/bin/pgrd host1 host2"
 --user pgreplicator
 --shutdown

Everything is fine with stdout.
Messages are in /var/log/pgr-daemon.log

But if my application, which is a TCL script,
writes something on stderr (as "puts stderr $msg"),
This message is written:
- at the beginning of the file, overwriting the
existing stdout text.
- only when the service is stopped.

Is it an as-is behaviour, a lack or a mistake in
the command syntaxes, or something wrong in
cygrunsrv or bash or tcl?



__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

[-- Attachment #2: cygcheck.out --]
[-- Type: application/octet-stream, Size: 14505 bytes --]


Cygwin Win95/NT Configuration Diagnostics
Current System Time: Fri Feb 13 11:46:13 2004

Windows NT Ver 4.0 Build 1381 Service Pack 6

Path:	D:\cygwin\usr\local\bin
	D:\cygwin\bin
	D:\cygwin\bin
	D:\cygwin\usr\local\pgsql\bin
	D:\cygwin\usr\local\pgsql\lib
	D:\cygwin\bin
	c:\WINNT\system32
	c:\WINNT
	c:\PROGRA~1\ULTRAE~1
	c:\MSSQL\BINN
	d:\j2sdk1.4.2_01\bin
	d:\Microsoft SDK for Java 4.0\Bin
	d:\Program Files\Sybase\shared
	d:\Program Files\Mts
	c:\Program Files\Common Files\Ulead Systems\MPEG
	.
	c:\Program Files\pb5i32dk

Output from D:\cygwin\bin\id.exe (nontsec)
UID: 400(Samson) GID: 401(mkpasswd)
401(mkpasswd)

Output from D:\cygwin\bin\id.exe (ntsec)
UID: 400(Samson) GID: 401(mkpasswd)
544(Administrators)  545(Users)           
401(mkpasswd)

SysDir: C:\WINNT\System32
WinDir: C:\WINNT

HOME = `c:\'
MAKE_MODE = `unix'
PWD = `/cygdrive/c'
TCL_LIBRARY = `D:\cygwin\usr\share\tcl8.4'
USER = `Samson'

COMPUTERNAME = `PC2020'
COMSPEC = `C:\WINNT\system32\cmd.exe'
HOMEDRIVE = `C:'
HOMEPATH = `\'
INCLUDE = `D:\Program Files\Mts\Include'
JAVA_HOME = `D:\j2sdk1.4.2_01'
LIB = `D:\Program Files\Mts\Lib'
LOGONSERVER = `\\NSAFILE'
NUMBER_OF_PROCESSORS = `1'
OLDPWD = `/usr/bin'
OS2LIBPATH = `C:\WINNT\system32\os2\dll;'
OS = `Windows_NT'
PATHEXT = `.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH'
PROCESSOR_ARCHITECTURE = `x86'
PROCESSOR_IDENTIFIER = `x86 Family 15 Model 0 Stepping 10, GenuineIntel'
PROCESSOR_LEVEL = `15'
PROCESSOR_REVISION = `000a'
PROMPT = `$P$G'
PS1 = `\[\033]0;\w\007
\033[32m\]\u@\h \[\033[33m\w\033[0m\]
$ '
SHLVL = `1'
SYSTEMDRIVE = `C:'
SYSTEMROOT = `C:\WINNT'
TEMP = `c:\TEMP'
TERM = `cygwin'
TMP = `c:\TEMP'
USERDOMAIN = `NSUISSE'
USERNAME = `Samson'
USERPROFILE = `C:\WINNT\Profiles\Samson.000'
WINDIR = `C:\WINNT'
_ = `/usr/bin/cygcheck'

HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2
  (default) = `/cygdrive'
  cygdrive flags = 0x00000020
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2
  (default) = `/cygdrive'
  cygdrive flags = 0x00000020
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/
  (default) = `D:\cygwin'
  flags = 0x00000008
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
  (default) = `D:\cygwin/bin'
  flags = 0x00000008
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
  (default) = `D:\cygwin/lib'
  flags = 0x00000008
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options

a:  fd           N/A    N/A                    
c:  hd  NTFS    2045Mb  67% CP CS UN PA FC     
d:  hd  NTFS   17046Mb  27% CP CS UN PA FC     
e:  fd           N/A    N/A                    
u:  fd           N/A    N/A                    
z:  cd           N/A    N/A                    

.              /cygdrive  user    textmode,cygdrive
D:\cygwin      /          system  textmode
D:\cygwin/bin  /usr/bin   system  textmode
D:\cygwin/lib  /usr/lib   system  textmode
.              /cygdrive  system  textmode,cygdrive

Found: D:\cygwin\bin\awk.exe
Found: D:\cygwin\bin\bash.exe
Found: D:\cygwin\bin\cat.exe
Found: D:\cygwin\bin\cp.exe
Found: D:\cygwin\bin\cpp.exe
Found: D:\cygwin\bin\find.exe
Found: D:\cygwin\bin\gcc.exe
Found: D:\cygwin\bin\gdb.exe
Found: D:\cygwin\bin\grep.exe
Found: D:\cygwin\bin\ld.exe
Found: D:\cygwin\bin\ls.exe
Found: D:\cygwin\bin\make.exe
Found: D:\cygwin\bin\mv.exe
Found: D:\cygwin\bin\rm.exe
Found: D:\cygwin\bin\sed.exe
Found: D:\cygwin\bin\sh.exe
Found: D:\cygwin\bin\tar.exe

   61k 2003/08/09 D:\cygwin\bin\cygbz2-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygbz2-1.dll" v0.0 ts=2003/8/9 8:35
    7k 2003/10/19 D:\cygwin\bin\cygcrypt-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygcrypt-0.dll" v0.0 ts=2003/10/19 9:57
   22k 2004/02/10 D:\cygwin\bin\cygcygipc-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygcygipc-2.dll" v0.0 ts=2004/2/10 3:48
  831k 2003/09/20 D:\cygwin\bin\cygdb-4.1.dll - os=4.0 img=1.0 sys=4.0
                  "cygdb-4.1.dll" v0.0 ts=2003/9/20 23:51
 1080k 2003/09/20 D:\cygwin\bin\cygdb_cxx-4.1.dll - os=4.0 img=1.0 sys=4.0
                  "cygdb_cxx-4.1.dll" v0.0 ts=2003/9/20 23:53
   45k 2001/04/25 D:\cygwin\bin\cygform5.dll - os=4.0 img=1.0 sys=4.0
                  "cygform5.dll" v0.0 ts=2001/4/25 7:28
   35k 2002/01/09 D:\cygwin\bin\cygform6.dll - os=4.0 img=1.0 sys=4.0
                  "cygform6.dll" v0.0 ts=2002/1/9 7:03
   48k 2003/08/09 D:\cygwin\bin\cygform7.dll - os=4.0 img=1.0 sys=4.0
                  "cygform7.dll" v0.0 ts=2003/8/9 11:25
   28k 2003/07/20 D:\cygwin\bin\cyggdbm-3.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm-3.dll" v0.0 ts=2003/7/20 9:58
   30k 2003/08/11 D:\cygwin\bin\cyggdbm-4.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm-4.dll" v0.0 ts=2003/8/11 4:12
   19k 2003/03/22 D:\cygwin\bin\cyggdbm.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm.dll" v0.0 ts=2002/2/20 4:05
   15k 2003/07/20 D:\cygwin\bin\cyggdbm_compat-3.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm_compat-3.dll" v0.0 ts=2003/7/20 10:00
   15k 2003/08/11 D:\cygwin\bin\cyggdbm_compat-4.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm_compat-4.dll" v0.0 ts=2003/8/11 4:13
   69k 2003/08/10 D:\cygwin\bin\cyggettextlib-0-12-1.dll - os=4.0 img=1.0 sys=4.0
                  "cyggettextlib-0-12-1.dll" v0.0 ts=2003/8/11 0:10
   12k 2003/08/10 D:\cygwin\bin\cyggettextpo-0.dll - os=4.0 img=1.0 sys=4.0
                  "cyggettextpo-0.dll" v0.0 ts=2003/8/11 0:11
  134k 2003/08/10 D:\cygwin\bin\cyggettextsrc-0-12-1.dll - os=4.0 img=1.0 sys=4.0
                  "cyggettextsrc-0-12-1.dll" v0.0 ts=2003/8/11 0:10
   17k 2001/06/28 D:\cygwin\bin\cyghistory4.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory4.dll" v0.0 ts=2001/1/7 5:34
   29k 2003/08/10 D:\cygwin\bin\cyghistory5.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory5.dll" v0.0 ts=2003/8/11 1:16
  958k 2003/08/10 D:\cygwin\bin\cygiconv-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygiconv-2.dll" v0.0 ts=2003/8/10 22:57
   22k 2001/12/13 D:\cygwin\bin\cygintl-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl-1.dll" v0.0 ts=2001/12/13 10:28
   37k 2003/08/10 D:\cygwin\bin\cygintl-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl-2.dll" v0.0 ts=2003/8/10 23:50
   21k 2001/06/20 D:\cygwin\bin\cygintl.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl.dll" v0.0 ts=2001/6/20 19:09
   32k 2003/08/18 D:\cygwin\bin\cygltdl-3.dll - os=4.0 img=1.0 sys=4.0
                  "cygltdl-3.dll" v0.0 ts=2003/8/18 7:35
   26k 2001/04/25 D:\cygwin\bin\cygmenu5.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu5.dll" v0.0 ts=2001/4/25 7:27
   20k 2002/01/09 D:\cygwin\bin\cygmenu6.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu6.dll" v0.0 ts=2002/1/9 7:03
   29k 2003/08/09 D:\cygwin\bin\cygmenu7.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu7.dll" v0.0 ts=2003/8/9 11:25
  156k 2001/04/25 D:\cygwin\bin\cygncurses++5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++5.dll" v0.0 ts=2001/4/25 7:29
  175k 2002/01/09 D:\cygwin\bin\cygncurses++6.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++6.dll" v0.0 ts=2002/1/9 7:03
  226k 2001/04/25 D:\cygwin\bin\cygncurses5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses5.dll" v0.0 ts=2001/4/25 7:17
  202k 2002/01/09 D:\cygwin\bin\cygncurses6.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses6.dll" v0.0 ts=2002/1/9 7:03
  224k 2003/08/09 D:\cygwin\bin\cygncurses7.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses7.dll" v0.0 ts=2003/8/9 11:24
   15k 2001/04/25 D:\cygwin\bin\cygpanel5.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel5.dll" v0.0 ts=2001/4/25 7:27
   12k 2002/01/09 D:\cygwin\bin\cygpanel6.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel6.dll" v0.0 ts=2002/1/9 7:03
   19k 2003/08/09 D:\cygwin\bin\cygpanel7.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel7.dll" v0.0 ts=2003/8/9 11:24
   62k 2003/12/11 D:\cygwin\bin\cygpcre-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygpcre-0.dll" v0.0 ts=2003/12/11 18:01
   63k 2003/04/11 D:\cygwin\bin\cygpcre.dll - os=4.0 img=1.0 sys=4.0
                  "cygpcre.dll" v0.0 ts=2003/4/11 10:31
    9k 2003/12/11 D:\cygwin\bin\cygpcreposix-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygpcreposix-0.dll" v0.0 ts=2003/12/11 18:01
   61k 2003/04/11 D:\cygwin\bin\cygpcreposix.dll - os=4.0 img=1.0 sys=4.0
                  "cygpcreposix.dll" v0.0 ts=2003/4/11 10:31
 1049k 2003/11/07 D:\cygwin\bin\cygperl5_8_2.dll - os=4.0 img=1.0 sys=4.0
                  "cygperl5_8_2.dll" v0.0 ts=2003/11/7 12:08
   22k 2002/06/09 D:\cygwin\bin\cygpopt-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygpopt-0.dll" v0.0 ts=2002/6/9 7:45
  108k 2001/06/28 D:\cygwin\bin\cygreadline4.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline4.dll" v0.0 ts=2001/1/7 5:34
  148k 2003/08/10 D:\cygwin\bin\cygreadline5.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline5.dll" v0.0 ts=2003/8/11 1:16
  948k 2003/03/18 D:\cygwin\bin\cygwin1-20030318.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=2003/3/18 15:20
  887k 2003/04/25 D:\cygwin\bin\cygwin1-20030421.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=2003/4/21 6:40
   61k 2003/12/04 D:\cygwin\bin\cygz.dll - os=4.0 img=1.0 sys=4.0
                  "cygz.dll" v0.0 ts=2003/12/4 4:03
 1083k 2004/01/31 D:\cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=2004/1/31 1:32
    Cygwin DLL version info:
        DLL version: 1.5.7
        DLL epoch: 19
        DLL bad signal mask: 19005
        DLL old termios: 5
        DLL malloc env: 28
        API major: 0
        API minor: 109
        Shared data: 3
        DLL identifier: cygwin1
        Mount registry: 2
        Cygnus registry name: Cygnus Solutions
        Cygwin registry name: Cygwin
        Program options name: Program Options
        Cygwin mount registry name: mounts v2
        Cygdrive flags: cygdrive flags
        Cygdrive prefix: cygdrive prefix
        Cygdrive default prefix: 
        Build date: Fri Jan 30 19:32:04 EST 2004
        CVS tag: cr-0x9e
        Shared id: cygwin1S3


Cygwin Package Information
Last downloaded files to: D:\Download\Cygwin
Last downloaded files from: ftp://ftp.easynet.be/cygwin

Package              Version            
_update-info-dir     00226-1            
ash                  20040127-1         
autoconf             2.59-1             
autoconf-devel       2.59-1             
autoconf-stable      2.13-5             
automake             1.7.9-1            
automake-devel       1.7.9-1            
automake-stable      1.4p6-2            
base-files           2.6-1              
base-passwd          1.1-1              
bash                 2.05b-16           
binutils             20030901-1         
bzip2                1.0.2-5            
cron                 3.0.1-11           
crypt                1.1-1              
cygipc               2.03-2             
cygrunsrv            0.98-1             
cygutils             1.2.4-1            
cygwin               1.5.7-1            
cygwin-doc           1.3-6              
diff                 0.0                
diffutils            2.8.4-1            
editrights           1.01-1             
file                 4.06-1             
fileutils            4.1-2              
findutils            4.1.7-4            
gawk                 3.1.3-4            
gcc                  3.3.1-3            
gcc-mingw            20030911-4         
gcc-mingw-core       20031020-1         
gdb                  20030919-1         
gdbm                 1.8.3-7            
grep                 2.5-1              
groff                1.18.1-2           
gzip                 1.3.5-1            
inetutils            1.3.2-25           
less                 381-1              
libbz2_1             1.0.2-5            
libdb4.1             4.1.25-1           
libgdbm              1.8.0-5            
libgdbm-devel        1.8.3-7            
libgdbm3             1.8.3-3            
libgdbm4             1.8.3-7            
libgettextpo0        0.12.1-3           
libiconv2            1.9.1-3            
libintl              0.10.38-3          
libintl1             0.10.40-1          
libintl2             0.12.1-3           
libltdl3             1.5-3              
libncurses5          5.2-1              
libncurses6          5.2-8              
libncurses7          5.3-4              
libpcre              4.1-1              
libpcre0             4.5-1              
libpopt0             1.6.4-4            
libreadline4         4.1-2              
libreadline5         4.3-5              
libtool              1.5b-1             
libtool-devel        1.5-3              
libtool-stable       1.4.3-2            
login                1.9-7              
m4                   1.4-1              
make                 3.80-1             
man                  1.5k-2             
mingw-runtime        3.2-1              
mktemp               1.5-3              
more                 2.11o-1            
ncurses              5.3-4              
patch                2.5.8-8            
pcre                 4.5-1              
pcre-doc             4.5-1              
perl                 5.8.2-1            
popt                 1.6.4-4            
readline             4.3-5              
sed                  4.0.8-1            
sh-utils             2.0.15-4           
tar                  1.13.25-5          
tcltk                20030901-1         
termcap              20021106-2         
terminfo             5.3_20030726-1     
texinfo              4.2-4              
textutils            2.0.21-1           
vim                  6.2.098-1          
w32api               2.4-1              
which                1.5-2              
zlib                 1.2.1-1            
Use -h to see help about each section

[-- Attachment #3: Type: text/plain, Size: 218 bytes --]

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: stdout/stderr handling by cygrunsrv/bash/tcl
  2004-03-02 16:36 stdout/stderr handling by cygrunsrv/bash/tcl Patrick Samson
@ 2004-03-02 19:27 ` Igor Pechtchanski
  2004-03-03 13:12   ` Patrick Samson
  0 siblings, 1 reply; 7+ messages in thread
From: Igor Pechtchanski @ 2004-03-02 19:27 UTC (permalink / raw)
  To: Patrick Samson; +Cc: cygwin

On Tue, 2 Mar 2004, Patrick Samson wrote:

> I run a service installed as:
>
> cygrunsrv --install pgr-daemon
>  --path /usr/bin/bash.exe
>  --args "--login /opt/pgreplica/bin/pgrd host1 host2"
>  --user pgreplicator
>  --shutdown
>
> Everything is fine with stdout.  Messages are in /var/log/pgr-daemon.log
>
> But if my application, which is a TCL script, writes something on stderr
> (as "puts stderr $msg"),
> This message is written:
> - at the beginning of the file, overwriting the existing stdout text.
> - only when the service is stopped.
>
> Is it an as-is behaviour, a lack or a mistake in the command syntaxes,
> or something wrong in cygrunsrv or bash or tcl?

Patrick,

WFM.  I can't reproduce your problem on Win2k (without Tcl and --user).
Here's what I did:

$ mkdir /tmp/servicetest && cd /tmp/servicetest
$ cat > service.sh
#!/bin/bash
terminate() {
  echo "Terminating" >&2
  exit 0
}
trap terminate INT
echo "Starting service" >&2
trap -p
while true; do
  sleep 10
  echo "STDERR" >&2
  echo "STDOUT" >&1
done
$ cygrunsrv --install test-daemon --path /usr/bin/bash.exe --args "--login /tmp/servicetest/service.sh" --termsig INT --shutdown
$ cygrunsrv -S test-daemon; sleep 30; cygrunsrv -E test-daemon
$ cat /var/log/test-daemon.log
Starting service
trap -- 'terminate' SIGINT
STDERR
STDOUT
STDERR
STDOUT
STDERR
STDOUT
Terminating
$

So, messages going to stdout/stderr were properly redirected.  If the
above works for you, try adding a Tcl call to the test script, and see if
it changes anything.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: stdout/stderr handling by cygrunsrv/bash/tcl
  2004-03-02 19:27 ` Igor Pechtchanski
@ 2004-03-03 13:12   ` Patrick Samson
  2004-03-03 14:56     ` Igor Pechtchanski
  0 siblings, 1 reply; 7+ messages in thread
From: Patrick Samson @ 2004-03-03 13:12 UTC (permalink / raw)
  To: cygwin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 4391 bytes --]


--- Igor Pechtchanski wrote:
> On Tue, 2 Mar 2004, Patrick Samson wrote:
> 
> > I run a service installed as:
> >
> > cygrunsrv --install pgr-daemon
> >  --path /usr/bin/bash.exe
> >  --args "--login /opt/pgreplica/bin/pgrd host1
> host2"
> >  --user pgreplicator
> >  --shutdown
> >
> > Everything is fine with stdout.  Messages are in
> /var/log/pgr-daemon.log
> >
> > But if my application, which is a TCL script,
> writes something on stderr
> > (as "puts stderr $msg"),
> > This message is written:
> > - at the beginning of the file, overwriting the
> existing stdout text.
> > - only when the service is stopped.
> >
> > Is it an as-is behaviour, a lack or a mistake in
> the command syntaxes,
> > or something wrong in cygrunsrv or bash or tcl?
> 
> Patrick,
> 
> WFM.  I can't reproduce your problem on Win2k
> (without Tcl and --user).
> Here's what I did:
> 
> $ mkdir /tmp/servicetest && cd /tmp/servicetest
> $ cat > service.sh
> #!/bin/bash
> terminate() {
>   echo "Terminating" >&2
>   exit 0
> }
> trap terminate INT
> echo "Starting service" >&2
> trap -p
> while true; do
>   sleep 10
>   echo "STDERR" >&2
>   echo "STDOUT" >&1
> done
> $ cygrunsrv --install test-daemon --path
> /usr/bin/bash.exe --args "--login
> /tmp/servicetest/service.sh" --termsig INT
> --shutdown
> $ cygrunsrv -S test-daemon; sleep 30; cygrunsrv -E
> test-daemon
> $ cat /var/log/test-daemon.log
> Starting service
> trap -- 'terminate' SIGINT
> STDERR
> STDOUT
> STDERR
> STDOUT
> STDERR
> STDOUT
> Terminating
> $
> 
> So, messages going to stdout/stderr were properly
> redirected.  If the
> above works for you, try adding a Tcl call to the
> test script, and see if
> it changes anything.

Your demo works as expected. But TCL introduces
the mess.

I changed the script to:

$ cat service.sh
#!/bin/bash
# the next line restart using tclsh \
exec tclsh "$0" "$@"

puts "Starting service"
while {true} {
  # wait 1 sec
  after 1000
  puts stderr "STDERR"
  puts "STDOUT"
}
$ cygrunsrv -S test-daemon; sleep 3; cygrunsrv -E
test-daemon
$ cat /var/log/test-daemon.log
STDERR
STDERR
STDERR
STDERR

STDOUT
STDOUT

It looks like the overwriting of these two lines
(cr lf are replaced by space):
STDERR  STDERR  STDERR  STDERR
Starting service  STDOUT  STDOUT  STDOUT  STDOUT

Just for the understanding, another trial with the
script beginning with a write to stderr:

$ cat service.sh
#!/bin/bash
# the next line restart using tclsh \
exec tclsh "$0" "$@"

puts stderr "Write stderr"
puts "Starting service"
while {true} {
  # wait 1 sec
  after 1000
  puts stderr "STDERR"
  puts "STDOUT"
}
$ cygrunsrv -S test-daemon; sleep 3; cygrunsrv -E
test-daemon
$ cat /var/log/test-daemon.log
Starting serviSTDESTDOSTDESTDOSTDESTDOSTDESTDOUT

Again the overwriting of these two lines:
Write stderr  STDERR  STDERR  STDERR  STDERR
Starting service  STDOUT  STDOUT  STDOUT  STDOUT

If I run the TCL directly, it's ok, no surprise:
$ ./service.sh
Write stderr
Starting service
STDERR
STDOUT
STDERR
STDOUT
STDERR
STDOUT
<manually interruped with ctrl/c>
$ ./service.sh >service.log 2>&1
<manually interruped with ctrl/c>
$ cat service.log
Write stderr
Starting service
STDERR
STDOUT
STDERR
STDOUT
STDERR
STDOUT

I wouldn't use this syntax, but it shows the same
problem, so it may be a clue:

$ ./service.sh >service.log 2>service.log
<manually interruped with ctrl/c>
$ cat service.log
Starting serviSTDESTDOSTDESTDOSTDESTDOUT

Continuing on this way, consider:
serviceSH.sh as the shell script of Igor,
serviceTCL.sh as the TCL script.

$ ./serviceSH.sh >service.log 2>service.log
trap -- 'terminateSTDERR
STDERR
Terminating

$ ./serviceSH.sh >>service.log 2>>service.log

Starting service
trap -- 'terminate' SIGINT
STDERR
STDOUT
STDERR
STDOUT
STDERR
STDOUT
Terminating

$ ./serviceTCL.sh >service.log 2>service.log

Starting serviSTDESTDOSTDESTDOSTDESTDOUT

$ ./serviceTCL.sh >>service.log 2>>service.log

Starting serviSTDESTDOSTDESTDOSTDESTDOSTDESTDOUT

Can someone tell us how cygrunsrv manages the
redirections? It's a step toward the explanation.



__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: stdout/stderr handling by cygrunsrv/bash/tcl
  2004-03-03 13:12   ` Patrick Samson
@ 2004-03-03 14:56     ` Igor Pechtchanski
  2004-03-03 16:21       ` Patrick Samson
  2004-03-04  5:55       ` AJ Reins
  0 siblings, 2 replies; 7+ messages in thread
From: Igor Pechtchanski @ 2004-03-03 14:56 UTC (permalink / raw)
  To: Patrick Samson; +Cc: cygwin

On Wed, 3 Mar 2004, Patrick Samson wrote:

> --- Igor Pechtchanski wrote:
> > On Tue, 2 Mar 2004, Patrick Samson wrote:
> >
> > > I run a service installed as:
> > >
> > > cygrunsrv --install pgr-daemon
> > >  --path /usr/bin/bash.exe
> > >  --args "--login /opt/pgreplica/bin/pgrd host1 host2"
> > >  --user pgreplicator
> > >  --shutdown
> > >
> > > Everything is fine with stdout.  Messages are in /var/log/pgr-daemon.log
> > >
> > > But if my application, which is a TCL script, writes something on stderr
> > > (as "puts stderr $msg"),
> > > This message is written:
> > > - at the beginning of the file, overwriting the existing stdout text.
> > > - only when the service is stopped.
> > >
> > > Is it an as-is behaviour, a lack or a mistake in the command syntaxes,
> > > or something wrong in cygrunsrv or bash or tcl?
> >
> > Patrick,
> >
> > WFM.  I can't reproduce your problem on Win2k
> > (without Tcl and --user).
> > Here's what I did:
> >
> > $ mkdir /tmp/servicetest && cd /tmp/servicetest
> > $ cat > service.sh
> > #!/bin/bash
> > terminate() {
> >   echo "Terminating" >&2
> >   exit 0
> > }
> > trap terminate INT
> > echo "Starting service" >&2
> > trap -p
> > while true; do
> >   sleep 10
> >   echo "STDERR" >&2
> >   echo "STDOUT" >&1
> > done
> > $ cygrunsrv --install test-daemon --path /usr/bin/bash.exe --args "--login /tmp/servicetest/service.sh" --termsig INT --shutdown
> > $ cygrunsrv -S test-daemon; sleep 30; cygrunsrv -E test-daemon
> > $ cat /var/log/test-daemon.log
> > Starting service
> > trap -- 'terminate' SIGINT
> > STDERR
> > STDOUT
> > STDERR
> > STDOUT
> > STDERR
> > STDOUT
> > Terminating
> > $
> >
> > So, messages going to stdout/stderr were properly redirected.  If the
> > above works for you, try adding a Tcl call to the test script, and see
> > if it changes anything.
>
> Your demo works as expected. But TCL introduces
> the mess.
>
> I changed the script to:
>
> $ cat service.sh
> #!/bin/bash
> # the next line restart using tclsh \
> exec tclsh "$0" "$@"
>
> puts "Starting service"
> while {true} {
>   # wait 1 sec
>   after 1000
>   puts stderr "STDERR"
>   puts "STDOUT"
> }
> $ cygrunsrv -S test-daemon; sleep 3; cygrunsrv -E
> test-daemon
> $ cat /var/log/test-daemon.log
> STDERR
> STDERR
> STDERR
> STDERR
>
> STDOUT
> STDOUT
>
> It looks like the overwriting of these two lines
> (cr lf are replaced by space):
> STDERR  STDERR  STDERR  STDERR
> Starting service  STDOUT  STDOUT  STDOUT  STDOUT
>
> Just for the understanding, another trial with the
> script beginning with a write to stderr:
>
> $ cat service.sh
> #!/bin/bash
> # the next line restart using tclsh \
> exec tclsh "$0" "$@"
>
> puts stderr "Write stderr"
> puts "Starting service"
> while {true} {
>   # wait 1 sec
>   after 1000
>   puts stderr "STDERR"
>   puts "STDOUT"
> }
> $ cygrunsrv -S test-daemon; sleep 3; cygrunsrv -E
> test-daemon
> $ cat /var/log/test-daemon.log
> Starting serviSTDESTDOSTDESTDOSTDESTDOSTDESTDOUT
>
> Again the overwriting of these two lines:
> Write stderr  STDERR  STDERR  STDERR  STDERR
> Starting service  STDOUT  STDOUT  STDOUT  STDOUT
>
> If I run the TCL directly, it's ok, no surprise:
> $ ./service.sh
> Write stderr
> Starting service
> STDERR
> STDOUT
> STDERR
> STDOUT
> STDERR
> STDOUT
> <manually interruped with ctrl/c>
> $ ./service.sh >service.log 2>&1
> <manually interruped with ctrl/c>
> $ cat service.log
> Write stderr
> Starting service
> STDERR
> STDOUT
> STDERR
> STDOUT
> STDERR
> STDOUT
>
> I wouldn't use this syntax, but it shows the same
> problem, so it may be a clue:
>
> $ ./service.sh >service.log 2>service.log
> <manually interruped with ctrl/c>
> $ cat service.log
> Starting serviSTDESTDOSTDESTDOSTDESTDOUT
>
> Continuing on this way, consider:
> serviceSH.sh as the shell script of Igor,
> serviceTCL.sh as the TCL script.
>
> $ ./serviceSH.sh >service.log 2>service.log
> trap -- 'terminateSTDERR
> STDERR
> Terminating
>
> $ ./serviceSH.sh >>service.log 2>>service.log
>
> Starting service
> trap -- 'terminate' SIGINT
> STDERR
> STDOUT
> STDERR
> STDOUT
> STDERR
> STDOUT
> Terminating
>
> $ ./serviceTCL.sh >service.log 2>service.log
>
> Starting serviSTDESTDOSTDESTDOSTDESTDOUT
>
> $ ./serviceTCL.sh >>service.log 2>>service.log
>
> Starting serviSTDESTDOSTDESTDOSTDESTDOSTDESTDOUT
>
> Can someone tell us how cygrunsrv manages the
> redirections? It's a step toward the explanation.

cygrunsrv redirects each file separately (like the '>>a 2>>a' syntax).
This is obviously a Tcl problem.  It seems that Tcl attempts to manage its
own buffering on STDOUT/STDERR, even when they are redirected.

Try adding an 'exec 2>&1' just before the 'exec tclsh "$0" "$@"' in your
serviceTCL.sh script.  Hopefully, Tcl will inherit the stderr from the
parent process...  If this works, you can add it to your main script,
since you know that both stdout and stderr will eventually go to the same
file anyway.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: stdout/stderr handling by cygrunsrv/bash/tcl
  2004-03-03 14:56     ` Igor Pechtchanski
@ 2004-03-03 16:21       ` Patrick Samson
  2004-03-04  5:55       ` AJ Reins
  1 sibling, 0 replies; 7+ messages in thread
From: Patrick Samson @ 2004-03-03 16:21 UTC (permalink / raw)
  To: cygwin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 4240 bytes --]


--- Igor Pechtchanski wrote:
> On Wed, 3 Mar 2004, Patrick Samson wrote:
> 
> > Your demo works as expected. But TCL introduces
> > the mess.
> >
> > I changed the script to:
> >
> > $ cat service.sh
> > #!/bin/bash
> > # the next line restart using tclsh \
> > exec tclsh "$0" "$@"
> >
> > puts "Starting service"
> > while {true} {
> >   # wait 1 sec
> >   after 1000
> >   puts stderr "STDERR"
> >   puts "STDOUT"
> > }
> > $ cygrunsrv -S test-daemon; sleep 3; cygrunsrv -E
> > test-daemon
> > $ cat /var/log/test-daemon.log
> > STDERR
> > STDERR
> > STDERR
> > STDERR
> >
> > STDOUT
> > STDOUT
> >
> > It looks like the overwriting of these two lines
> > (cr lf are replaced by space):
> > STDERR  STDERR  STDERR  STDERR
> > Starting service  STDOUT  STDOUT  STDOUT  STDOUT
> >
> > Just for the understanding, another trial with the
> > script beginning with a write to stderr:
> >
> > $ cat service.sh
> > #!/bin/bash
> > # the next line restart using tclsh \
> > exec tclsh "$0" "$@"
> >
> > puts stderr "Write stderr"
> > puts "Starting service"
> > while {true} {
> >   # wait 1 sec
> >   after 1000
> >   puts stderr "STDERR"
> >   puts "STDOUT"
> > }
> > $ cygrunsrv -S test-daemon; sleep 3; cygrunsrv -E
> > test-daemon
> > $ cat /var/log/test-daemon.log
> > Starting serviSTDESTDOSTDESTDOSTDESTDOSTDESTDOUT
> >
> > Again the overwriting of these two lines:
> > Write stderr  STDERR  STDERR  STDERR  STDERR
> > Starting service  STDOUT  STDOUT  STDOUT  STDOUT
> >
> > If I run the TCL directly, it's ok, no surprise:
> > $ ./service.sh
> > Write stderr
> > Starting service
> > STDERR
> > STDOUT
> > STDERR
> > STDOUT
> > STDERR
> > STDOUT
> > <manually interruped with ctrl/c>
> > $ ./service.sh >service.log 2>&1
> > <manually interruped with ctrl/c>
> > $ cat service.log
> > Write stderr
> > Starting service
> > STDERR
> > STDOUT
> > STDERR
> > STDOUT
> > STDERR
> > STDOUT
> >
> > I wouldn't use this syntax, but it shows the same
> > problem, so it may be a clue:
> >
> > $ ./service.sh >service.log 2>service.log
> > <manually interruped with ctrl/c>
> > $ cat service.log
> > Starting serviSTDESTDOSTDESTDOSTDESTDOUT
> >
> > Continuing on this way, consider:
> > serviceSH.sh as the shell script of Igor,
> > serviceTCL.sh as the TCL script.
> >
> > $ ./serviceSH.sh >service.log 2>service.log
> > trap -- 'terminateSTDERR
> > STDERR
> > Terminating
> >
> > $ ./serviceSH.sh >>service.log 2>>service.log
> >
> > Starting service
> > trap -- 'terminate' SIGINT
> > STDERR
> > STDOUT
> > STDERR
> > STDOUT
> > STDERR
> > STDOUT
> > Terminating
> >
> > $ ./serviceTCL.sh >service.log 2>service.log
> >
> > Starting serviSTDESTDOSTDESTDOSTDESTDOUT
> >
> > $ ./serviceTCL.sh >>service.log 2>>service.log
> >
> > Starting serviSTDESTDOSTDESTDOSTDESTDOSTDESTDOUT
> >
> > Can someone tell us how cygrunsrv manages the
> > redirections? It's a step toward the explanation.
> 
> cygrunsrv redirects each file separately (like the
> '>>a 2>>a' syntax).
> This is obviously a Tcl problem.  It seems that Tcl
> attempts to manage its
> own buffering on STDOUT/STDERR, even when they are
> redirected.
> 
> Try adding an 'exec 2>&1' just before the 'exec
> tclsh "$0" "$@"' in your serviceTCL.sh script.  
> Hopefully, Tcl will inherit the stderr from the
> parent process...  If this works, you can add it to
> your main script, since you know that both stdout
> and stderr will eventually go to the same file
> anyway.

Yes! It works.

$ cat serviceTCL.sh
#!/bin/bash
# \
exec 2>&1
# the next line restart using tclsh \
exec tclsh "$0" "$@"

puts stderr "Write stderr"
puts "Starting service"
while {true} {
  # wait 1 sec
  after 1000
  puts stderr "STDERR"
  puts "STDOUT"
}

$ ./serviceTCL.sh >>service.log 2>>service.log
or
$ cygrunsrv -S test-daemon; sleep 3; cygrunsrv -E
test-daemon
give the correct outputs.

Thanks a lot, Igor.
I will check the problem with the Tcl team.



__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: stdout/stderr handling by cygrunsrv/bash/tcl
  2004-03-03 14:56     ` Igor Pechtchanski
  2004-03-03 16:21       ` Patrick Samson
@ 2004-03-04  5:55       ` AJ Reins
  2004-03-04  6:06         ` AJ Reins
  1 sibling, 1 reply; 7+ messages in thread
From: AJ Reins @ 2004-03-04  5:55 UTC (permalink / raw)
  To: cygwin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 5895 bytes --]


--- Igor Pechtchanski <pechtcha@cs.nyu.edu> wrote:
> On Wed, 3 Mar 2004, Patrick Samson wrote:
> 
> > --- Igor Pechtchanski wrote:
> > > On Tue, 2 Mar 2004, Patrick Samson wrote:
> > >
> > > > I run a service installed as:
> > > >
> > > > cygrunsrv --install pgr-daemon
> > > >  --path /usr/bin/bash.exe
> > > >  --args "--login /opt/pgreplica/bin/pgrd host1 host2"
> > > >  --user pgreplicator
> > > >  --shutdown
> > > >
> > > > Everything is fine with stdout.  Messages are in /var/log/pgr-daemon.log
> > > >
> > > > But if my application, which is a TCL script, writes something on stderr
> > > > (as "puts stderr $msg"),
> > > > This message is written:
> > > > - at the beginning of the file, overwriting the existing stdout text.
> > > > - only when the service is stopped.
> > > >
> > > > Is it an as-is behaviour, a lack or a mistake in the command syntaxes,
> > > > or something wrong in cygrunsrv or bash or tcl?
> > >
> > > Patrick,
> > >
> > > WFM.  I can't reproduce your problem on Win2k
> > > (without Tcl and --user).
> > > Here's what I did:
> > >
> > > $ mkdir /tmp/servicetest && cd /tmp/servicetest
> > > $ cat > service.sh
> > > #!/bin/bash
> > > terminate() {
> > >   echo "Terminating" >&2
> > >   exit 0
> > > }
> > > trap terminate INT
> > > echo "Starting service" >&2
> > > trap -p
> > > while true; do
> > >   sleep 10
> > >   echo "STDERR" >&2
> > >   echo "STDOUT" >&1
> > > done
> > > $ cygrunsrv --install test-daemon --path /usr/bin/bash.exe --args "--login
> /tmp/servicetest/service.sh" --termsig INT --shutdown
> > > $ cygrunsrv -S test-daemon; sleep 30; cygrunsrv -E test-daemon
> > > $ cat /var/log/test-daemon.log
> > > Starting service
> > > trap -- 'terminate' SIGINT
> > > STDERR
> > > STDOUT
> > > STDERR
> > > STDOUT
> > > STDERR
> > > STDOUT
> > > Terminating
> > > $
> > >
> > > So, messages going to stdout/stderr were properly redirected.  If the
> > > above works for you, try adding a Tcl call to the test script, and see
> > > if it changes anything.
> >
> > Your demo works as expected. But TCL introduces
> > the mess.
> >
> > I changed the script to:
> >
> > $ cat service.sh
> > #!/bin/bash
> > # the next line restart using tclsh \
> > exec tclsh "$0" "$@"
> >
> > puts "Starting service"
> > while {true} {
> >   # wait 1 sec
> >   after 1000
> >   puts stderr "STDERR"
> >   puts "STDOUT"
> > }
> > $ cygrunsrv -S test-daemon; sleep 3; cygrunsrv -E
> > test-daemon
> > $ cat /var/log/test-daemon.log
> > STDERR
> > STDERR
> > STDERR
> > STDERR
> >
> > STDOUT
> > STDOUT
> >
> > It looks like the overwriting of these two lines
> > (cr lf are replaced by space):
> > STDERR  STDERR  STDERR  STDERR
> > Starting service  STDOUT  STDOUT  STDOUT  STDOUT
> >
> > Just for the understanding, another trial with the
> > script beginning with a write to stderr:
> >
> > $ cat service.sh
> > #!/bin/bash
> > # the next line restart using tclsh \
> > exec tclsh "$0" "$@"
> >
> > puts stderr "Write stderr"
> > puts "Starting service"
> > while {true} {
> >   # wait 1 sec
> >   after 1000
> >   puts stderr "STDERR"
> >   puts "STDOUT"
> > }
> > $ cygrunsrv -S test-daemon; sleep 3; cygrunsrv -E
> > test-daemon
> > $ cat /var/log/test-daemon.log
> > Starting serviSTDESTDOSTDESTDOSTDESTDOSTDESTDOUT
> >
> > Again the overwriting of these two lines:
> > Write stderr  STDERR  STDERR  STDERR  STDERR
> > Starting service  STDOUT  STDOUT  STDOUT  STDOUT
> >
> > If I run the TCL directly, it's ok, no surprise:
> > $ ./service.sh
> > Write stderr
> > Starting service
> > STDERR
> > STDOUT
> > STDERR
> > STDOUT
> > STDERR
> > STDOUT
> > <manually interruped with ctrl/c>
> > $ ./service.sh >service.log 2>&1
> > <manually interruped with ctrl/c>
> > $ cat service.log
> > Write stderr
> > Starting service
> > STDERR
> > STDOUT
> > STDERR
> > STDOUT
> > STDERR
> > STDOUT
> >
> > I wouldn't use this syntax, but it shows the same
> > problem, so it may be a clue:
> >
> > $ ./service.sh >service.log 2>service.log
> > <manually interruped with ctrl/c>
> > $ cat service.log
> > Starting serviSTDESTDOSTDESTDOSTDESTDOUT
> >
> > Continuing on this way, consider:
> > serviceSH.sh as the shell script of Igor,
> > serviceTCL.sh as the TCL script.
> >
> > $ ./serviceSH.sh >service.log 2>service.log
> > trap -- 'terminateSTDERR
> > STDERR
> > Terminating
> >
> > $ ./serviceSH.sh >>service.log 2>>service.log
> >
> > Starting service
> > trap -- 'terminate' SIGINT
> > STDERR
> > STDOUT
> > STDERR
> > STDOUT
> > STDERR
> > STDOUT
> > Terminating
> >
> > $ ./serviceTCL.sh >service.log 2>service.log
> >
> > Starting serviSTDESTDOSTDESTDOSTDESTDOUT
> >
> > $ ./serviceTCL.sh >>service.log 2>>service.log
> >
> > Starting serviSTDESTDOSTDESTDOSTDESTDOSTDESTDOUT
> >
> > Can someone tell us how cygrunsrv manages the
> > redirections? It's a step toward the explanation.
> 
> cygrunsrv redirects each file separately (like the '>>a 2>>a' syntax).
> This is obviously a Tcl problem.  It seems that Tcl attempts to manage its
> own buffering on STDOUT/STDERR, even when they are redirected.
> 
> Try adding an 'exec 2>&1' just before the 'exec tclsh "$0" "$@"' in your
> serviceTCL.sh script.  Hopefully, Tcl will inherit the stderr from the
> parent process...  If this works, you can add it to your main script,
> since you know that both stdout and stderr will eventually go to the same
> file anyway.
> 	Igor

Doesn't Tcl buffer stdout by default? (Yes, that is a rhetorical question)
You could also do:
 fconfigure stdout -buffering none
to make stdout the same as stderr (not buffered by default).

__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: stdout/stderr handling by cygrunsrv/bash/tcl
  2004-03-04  5:55       ` AJ Reins
@ 2004-03-04  6:06         ` AJ Reins
  0 siblings, 0 replies; 7+ messages in thread
From: AJ Reins @ 2004-03-04  6:06 UTC (permalink / raw)
  To: cygwin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 566 bytes --]


--- I wrote:
> 
> --- Igor Pechtchanski <.> wrote:
ARRGGGHHHHH!  I am VERY sorry, Igor. I just plain did not think
to check for email addresses before I sent that. Please do not
make me go back to using B20! Please!


__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-03-04  0:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-02 16:36 stdout/stderr handling by cygrunsrv/bash/tcl Patrick Samson
2004-03-02 19:27 ` Igor Pechtchanski
2004-03-03 13:12   ` Patrick Samson
2004-03-03 14:56     ` Igor Pechtchanski
2004-03-03 16:21       ` Patrick Samson
2004-03-04  5:55       ` AJ Reins
2004-03-04  6:06         ` AJ Reins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).