unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH Nix] Flush substituter output upon ‘\r’
@ 2014-06-17 15:50 Ludovic Courtès
       [not found] ` <53A98315.1000800@logicblox.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2014-06-17 15:50 UTC (permalink / raw)
  To: nix-dev; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 478 bytes --]

The patch below changes the store so that it flushes what it reads from
the substituter’s stderr when it encounters either a newline or a
carriage return.

The intent is to allow substituters to provide some kind of progress
report, where the status is updated by means of a ‘\r’.

As a side effect, this patch removes the “substituter-name: ” prefix on
the lines that are printed.  It can be reinstated if deemed appropriate.

WDYT?

Thanks,
Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 817 bytes --]

diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 1293a6e..2819843 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -1141,8 +1141,10 @@ string LocalStore::getLineFromSubstituter(RunningSubstituter & run)
             if (n == 0) throw EndOfFile(format("substituter `%1%' died unexpectedly") % run.program);
             err.append(buf, n);
             string::size_type p;
-            while ((p = err.find('\n')) != string::npos) {
-                printMsg(lvlError, run.program + ": " + string(err, 0, p));
+            while (((p = err.find('\n')) != string::npos)
+		   || ((p = err.find('\r')) != string::npos)) {
+	        string thing(err, 0, p + 1);
+	        writeToStderr(thing);
                 err = string(err, p + 1);
             }
         }

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

_______________________________________________
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev

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

end of thread, other threads:[~2014-12-10  9:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-17 15:50 [PATCH Nix] Flush substituter output upon ‘\r’ Ludovic Courtès
     [not found] ` <53A98315.1000800@logicblox.com>
2014-06-24 16:08   ` Ludovic Courtès
2014-12-10  9:58     ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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).