Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Linux - Das System fuer schlaue Maedchen ;) -- banshee


devel / comp.lang.tcl / in command line program, how to output the progress in the same line

SubjectAuthor
* in command line program, how to output the progress in the same lineluocl
+* Re: in command line program, how to output the progress in the sameSchelte
|`- Re: in command line program, how to output the progress in the sameluocl
+- Re: in command line program, how to output the progress in the sameapn
+- Re: in command line program, how to output the progress in the sameluocl
`* Re: in command line program, how to output the progress in the same lineRobert Heller
 `- Re: in command line program, how to output the progress in the sameluocl

1
in command line program, how to output the progress in the same line

<t6pshu$1dt8$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19406&group=comp.lang.tcl#19406

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!aioe.org!i/jqiFaJeW9DsF1xo/xt8g.user.46.165.242.75.POSTED!not-for-mail
From: vimperatorluo@qq.com (luocl)
Newsgroups: comp.lang.tcl
Subject: in command line program, how to output the progress in the same line
Date: Fri, 27 May 2022 14:53:50 +0800
Organization: Aioe.org NNTP Server
Message-ID: <t6pshu$1dt8$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="47016"; posting-host="i/jqiFaJeW9DsF1xo/xt8g.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
Thunderbird/68.12.0
Content-Language: en-US
X-Mozilla-News-Host: news://nntp.aioe.org:119
X-Notice: Filtered by postfilter v. 0.9.2
 by: luocl - Fri, 27 May 2022 06:53 UTC

#!/usr/bin/env -S tclsh
proc relay fd {
set out [read $fd]
if {{} ne $out} {
puts -nonewline $out
flush stdout
}
if {[eof $fd]} {
close $fd
set ::forever 1
}
} set fd [open "| fossil clone
https://chiselapp.com/user/LuoChunlei/repository/luocl luocl.fossil 2>@1" r]
chan configure $fd -blocking 0 -buffering none
fileevent $fd readable [list relay $fd]
vwait ::forever
return

run the tcl script of the above, can not obtain the following [fossil
clone] output, the [script] output in the last. how can I output the
progress in the same line???

[fossil clone https://chiselapp.com/user/LuoChunlei/repository/luocl
luocl.fossil 2>@1] output:
Round-trips: 2 Artifacts sent: 0 received: 146
Clone done, sent: 584 received: 79948 ip: 74.208.146.128
Rebuilding repository meta-data...
100.0% complete...
Extra delta compression...
Vacuuming the database...
project-id: 2d2b2705f0290a1ad6d74e67624da7be0f311728
server-id: bc6f8571ca049ec687520d9a762d154560fa7438
admin-user: luocl (password is "2SrHjLvRFP")

[script] output:
Round-trips: 1 Artifacts sent: 0 received: 0
Round-trips: 1 Artifacts sent: 0 received: 143
Round-trips: 2 Artifacts sent: 0 received: 143
Round-trips: 2 Artifacts sent: 0 received: 146
Clone done, sent: 582 received: 79948 ip: 74.208.146.128
Rebuilding repository meta-data...
0.0% complete...
0.6% complete...
1.3% complete...
.
.
.
99.3% complete...
100.0% complete...
Extra delta compression...
Vacuuming the database...
project-id: 2d2b2705f0290a1ad6d74e67624da7be0f311728
server-id: 2c8b2e79dcce66c9f4aaeff964ce51660f9e1788
admin-user: luocl (password is "Mf3AVgedCu")

Re: in command line program, how to output the progress in the same line

<nnd$4aa87984$70c636e4@df623900d93aecbe>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19407&group=comp.lang.tcl#19407

  copy link   Newsgroups: comp.lang.tcl
Date: Fri, 27 May 2022 09:52:19 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.9.0
Subject: Re: in command line program, how to output the progress in the same
line
Content-Language: en-US
Newsgroups: comp.lang.tcl
References: <t6pshu$1dt8$1@gioia.aioe.org>
From: nospam@wanadoo.nl (Schelte)
In-Reply-To: <t6pshu$1dt8$1@gioia.aioe.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <nnd$4aa87984$70c636e4@df623900d93aecbe>
Organization: KPN B.V.
Path: i2pn2.org!i2pn.org!aioe.org!news.mb-net.net!open-news-network.org!news.mind.de!bolzen.all.de!npeer.as286.net!npeer-ng0.as286.net!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!abe006.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail
Lines: 13
Injection-Date: Fri, 27 May 2022 09:52:19 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 1304
 by: Schelte - Fri, 27 May 2022 07:52 UTC

On 27/05/2022 08:53, luocl wrote:
> how can I output the progress in the same line???

My guess, without actually trying the code: The progress output is
probably generated using \r to overwrite a previous line. By default Tcl
will treat all of \n, \r, and \r\n as a newline and translate it to \n.
You don't want that in this case. So narrow down the newline translation:

chan configure $fd -translation lf

Schelte.

Re: in command line program, how to output the progress in the same line

<t6q0cb$upg$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19408&group=comp.lang.tcl#19408

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: palmtcl@yahoo.com (apn)
Newsgroups: comp.lang.tcl
Subject: Re: in command line program, how to output the progress in the same
line
Date: Fri, 27 May 2022 13:28:57 +0530
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <t6q0cb$upg$1@dont-email.me>
References: <t6pshu$1dt8$1@gioia.aioe.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 27 May 2022 07:59:07 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="b2878ab38e15dbe257bb6d4690bca929";
logging-data="31536"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19a5giMEDs3XqFlZahw7grk"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.9.0
Cancel-Lock: sha1:skOlj3ljIgkeuxGe5KkXO4c6CAA=
In-Reply-To: <t6pshu$1dt8$1@gioia.aioe.org>
Content-Language: en-US
 by: apn - Fri, 27 May 2022 07:58 UTC

On 5/27/2022 12:23 PM, luocl wrote:
> run the tcl script of the above, can not obtain the following [fossil
> clone] output, the [script] output in the last. how can I output the
> progress in the same line???

Either use [puts -nonewline] in combination with ANSI terminal sequences
or with \r to back to the start of the line.

% puts -nonewline "Wait a bit ..." ; flush stdout; after 1000 ; puts
"\rAll done. "

Note if you use \r, you'll need trailing blanks to overwrite the
previous output unless all lines are the same length. ANSI terminal
sequences are better in that respect but I'm not sure if all Windows
consoles support them.

/Ashok

Re: in command line program, how to output the progress in the same line

<t6q46m$q69$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19409&group=comp.lang.tcl#19409

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!aioe.org!i/jqiFaJeW9DsF1xo/xt8g.user.46.165.242.75.POSTED!not-for-mail
From: vimperatorluo@qq.com (luocl)
Newsgroups: comp.lang.tcl
Subject: Re: in command line program, how to output the progress in the same
line
Date: Fri, 27 May 2022 17:04:22 +0800
Organization: Aioe.org NNTP Server
Message-ID: <t6q46m$q69$1@gioia.aioe.org>
References: <t6pshu$1dt8$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="26825"; posting-host="i/jqiFaJeW9DsF1xo/xt8g.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
Thunderbird/68.12.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: luocl - Fri, 27 May 2022 09:04 UTC

#!/usr/bin/env -S tclsh
proc relay fd {
set out [read $fd]
if {{} ne $out} {
puts -nonewline $out
flush stdout
update
}
if {[eof $fd]} {
close $fd
set ::forever 1
}
} set fd [open "| fossil clone
https://chiselapp.com/user/LuoChunlei/repository/luocl luocl.fossil 2>@1" r]
chan configure $fd -blocking 0 -buffering none -translation lf
fileevent $fd readable [list relay $fd]
vwait ::forever
return

now the [script]'s output is exactly the [fossil clone]'s output. Thank
you all!!!, from Schelte's reply I add "-translation lf" to the [chan
configure], from apn's reply I add [update] after [puts]

Re: in command line program, how to output the progress in the same line

<EOOdnTR1W-Z0eg3_nZ2dnUU7-U_NnZ2d@giganews.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19410&group=comp.lang.tcl#19410

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!3.us.feeder.erje.net!feeder.erje.net!border1.nntp.dca1.giganews.com!nntp.giganews.com!buffer1.nntp.dca1.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Fri, 27 May 2022 10:02:01 -0500
MIME-Version: 1.0
From: heller@deepsoft.com (Robert Heller)
Organization: Deepwoods Software
X-Newsreader: TkNews 3.0 (1.2.12)
Subject: Re: in command line program, how to output the progress in the same line
In-Reply-To: <t6pshu$1dt8$1@gioia.aioe.org>
References: <t6pshu$1dt8$1@gioia.aioe.org>
Newsgroups: comp.lang.tcl
Content-Type: text/plain;
charset="us-ascii"
Originator: heller@sharky4.deepsoft.com
Message-ID: <EOOdnTR1W-Z0eg3_nZ2dnUU7-U_NnZ2d@giganews.com>
Date: Fri, 27 May 2022 10:02:01 -0500
Lines: 73
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-mDWn97g01a8+XoRqRZ8jvUpVl8u3QtPmsWGKwphoJTlSR/COMT2maFG/8Ay179VFKJbuS4xCaIDW+KW!XuA4PqahRe0XZS4QtTEcExcXQWEdTXTQCVvCMH0h4wa+sOYw3ama/x2bEvkUiC4fR6IEMrrIqMz4!pSI=
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 3679
 by: Robert Heller - Fri, 27 May 2022 15:02 UTC

At Fri, 27 May 2022 14:53:50 +0800 luocl <vimperatorluo@qq.com> wrote:

>
> #!/usr/bin/env -S tclsh
> proc relay fd {
set CR "\r"
set NLPatttern "\n$"
> set out [read $fd]
> if {{} ne $out} {
> puts -nonewline $out

set out [regsub -all $NLPattern $out ""];# Remove trailing newlines
puts -nonewline "${CR}$out";# Prefix output with a Carriage return

> flush stdout
> }
> if {[eof $fd]} {
> close $fd
> set ::forever 1
> }
> }
> set fd [open "| fossil clone
> https://chiselapp.com/user/LuoChunlei/repository/luocl luocl.fossil 2>@1" r]
> chan configure $fd -blocking 0 -buffering none
> fileevent $fd readable [list relay $fd]
> vwait ::forever
> return
>
> run the tcl script of the above, can not obtain the following [fossil
> clone] output, the [script] output in the last. how can I output the
> progress in the same line???
>
> [fossil clone https://chiselapp.com/user/LuoChunlei/repository/luocl
> luocl.fossil 2>@1] output:
> Round-trips: 2 Artifacts sent: 0 received: 146
> Clone done, sent: 584 received: 79948 ip: 74.208.146.128
> Rebuilding repository meta-data...
> 100.0% complete...
> Extra delta compression...
> Vacuuming the database...
> project-id: 2d2b2705f0290a1ad6d74e67624da7be0f311728
> server-id: bc6f8571ca049ec687520d9a762d154560fa7438
> admin-user: luocl (password is "2SrHjLvRFP")
>
> [script] output:
> Round-trips: 1 Artifacts sent: 0 received: 0
> Round-trips: 1 Artifacts sent: 0 received: 143
> Round-trips: 2 Artifacts sent: 0 received: 143
> Round-trips: 2 Artifacts sent: 0 received: 146
> Clone done, sent: 582 received: 79948 ip: 74.208.146.128
> Rebuilding repository meta-data...
> 0.0% complete...
> 0.6% complete...
> 1.3% complete...
> .
> .
> .
> 99.3% complete...
> 100.0% complete...
> Extra delta compression...
> Vacuuming the database...
> project-id: 2d2b2705f0290a1ad6d74e67624da7be0f311728
> server-id: 2c8b2e79dcce66c9f4aaeff964ce51660f9e1788
> admin-user: luocl (password is "Mf3AVgedCu")
>
>

--
Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
heller@deepsoft.com -- Webhosting Services

Re: in command line program, how to output the progress in the same line

<t6rpvb$754$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19411&group=comp.lang.tcl#19411

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!aioe.org!0nxhSPnS0N4D7oYHTZMJWw.user.46.165.242.75.POSTED!not-for-mail
From: vimperatorluo@qq.com (luocl)
Newsgroups: comp.lang.tcl
Subject: Re: in command line program, how to output the progress in the same
line
Date: Sat, 28 May 2022 08:22:02 +0800
Organization: Aioe.org NNTP Server
Message-ID: <t6rpvb$754$1@gioia.aioe.org>
References: <t6pshu$1dt8$1@gioia.aioe.org>
<EOOdnTR1W-Z0eg3_nZ2dnUU7-U_NnZ2d@giganews.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="7332"; posting-host="0nxhSPnS0N4D7oYHTZMJWw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
Thunderbird/68.12.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: luocl - Sat, 28 May 2022 00:22 UTC

IMO, for the script, Schelte's solution is better.

Re: in command line program, how to output the progress in the same line

<t6rrir$m2d$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19412&group=comp.lang.tcl#19412

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!aioe.org!0nxhSPnS0N4D7oYHTZMJWw.user.46.165.242.75.POSTED!not-for-mail
From: vimperatorluo@qq.com (luocl)
Newsgroups: comp.lang.tcl
Subject: Re: in command line program, how to output the progress in the same
line
Date: Sat, 28 May 2022 08:49:31 +0800
Organization: Aioe.org NNTP Server
Message-ID: <t6rrir$m2d$1@gioia.aioe.org>
References: <t6pshu$1dt8$1@gioia.aioe.org>
<nnd$4aa87984$70c636e4@df623900d93aecbe>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="22605"; posting-host="0nxhSPnS0N4D7oYHTZMJWw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
Thunderbird/68.12.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: luocl - Sat, 28 May 2022 00:49 UTC

On 5/27/22 3:52 PM, Schelte wrote:
>
>     chan configure $fd -translation lf
I just suddenly thought, maybe "-translation binary" is the same, so I
test it, as expected it is ok.

Thank you again, for remarkable package {tee timestamp www mqtt fsdialog
fswatch etc.}
>
>
> Schelte.


devel / comp.lang.tcl / in command line program, how to output the progress in the same line

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor