From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: =?utf-8?q?=5BPATCH_Nix=5D_Flush_substituter_output_upon?= =?utf-8?b?IOKAmFxy4oCZ?= Date: Tue, 24 Jun 2014 18:08:25 +0200 Message-ID: <871tue1e9y.fsf@gnu.org> References: <877g4fcz7a.fsf@gnu.org> <53A98315.1000800@logicblox.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: In-Reply-To: <53A98315.1000800@logicblox.com> (Eelco Dolstra's message of "Tue, 24 Jun 2014 15:54:29 +0200") List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nix-dev-bounces@lists.science.uu.nl Errors-To: nix-dev-bounces@lists.science.uu.nl To: Eelco Dolstra Cc: guix-devel@gnu.org, nix-dev List-Id: guix-devel.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Please use reply-to-all. Eelco Dolstra skribis: > On 17/06/14 17:50, Ludovic Court=C3=A8s wrote: > >> The patch below changes the store so that it flushes what it reads from >> the substituter=E2=80=99s stderr when it encounters either a newline or a >> carriage return. >>=20 >> The intent is to allow substituters to provide some kind of progress >> report, where the status is updated by means of a =E2=80=98\r=E2=80=99. > > What kind of progress report do you mean, and why wouldn't '\n' work for = that? Progress reports: 0%\r 1%\r 2%\r >> As a side effect, this patch removes the =E2=80=9Csubstituter-name: =E2= =80=9D prefix on >> the lines that are printed. It can be reinstated if deemed appropriate. > > Please do, without it there is no indication where the error came from. Here it is. Thanks, Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 1293a6e..079972c 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(run.program + ": " + thing); err = string(err, p + 1); } } --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev --=-=-=--