diff mbox series

[LIBPHOBOS] Cleanup temp files in libphobos unittest at src/std/process.d

Message ID AM8PR10MB47082756EC1AAACAB6E46A1DE4509@AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM
State New
Headers show
Series [LIBPHOBOS] Cleanup temp files in libphobos unittest at src/std/process.d | expand

Commit Message

Bernd Edlinger May 14, 2021, 5:19 a.m. UTC
Hi,

I've noticed that a couple temp files are leaked after each full
gcc test-suite run.

I'd like to fix that by the following patch.


Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
Is it OK for trunk?


Thanks
Bernd.

Comments

Iain Buclaw May 14, 2021, 9:55 a.m. UTC | #1
Excerpts from Bernd Edlinger's message of May 14, 2021 7:19 am:
> Hi,
> 
> I've noticed that a couple temp files are leaked after each full
> gcc test-suite run.
> 
> I'd like to fix that by the following patch.
> 
> 
> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
> Is it OK for trunk?
> 

Thanks, looks reasonable to me.  Can you first post the patch upstream?

https://github.com/dlang/phobos/pulls

Just targeting the dmd-cxx branch is fine.  Then update
libdruntime/MERGE with the latest commit reference.

Iain.
Bernd Edlinger May 14, 2021, 10:43 a.m. UTC | #2
Hi Iain,

On 5/14/21 11:55 AM, Iain Buclaw wrote:
> Excerpts from Bernd Edlinger's message of May 14, 2021 7:19 am:
>> Hi,
>>
>> I've noticed that a couple temp files are leaked after each full
>> gcc test-suite run.
>>
>> I'd like to fix that by the following patch.
>>
>>
>> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
>> Is it OK for trunk?
>>
> 
> Thanks, looks reasonable to me.  Can you first post the patch upstream?
> 
> https://github.com/dlang/phobos/pulls
> 
> Just targeting the dmd-cxx branch is fine.  Then update
> libdruntime/MERGE with the latest commit reference.
> 

Okay, done, https://github.com/dlang/phobos/pull/8074 
that merge was very fast indeed :-)

Will that PR be eventually pushed to the https://github.com/dlang/druntime
as well, so I can update the libdruntime/MERGE with this commit-reference?


Thanks
Bernd.
Iain Buclaw May 14, 2021, 11:54 a.m. UTC | #3
Excerpts from Bernd Edlinger's message of May 14, 2021 12:43 pm:
> Hi Iain,
> 
> On 5/14/21 11:55 AM, Iain Buclaw wrote:
>> Excerpts from Bernd Edlinger's message of May 14, 2021 7:19 am:
>>> Hi,
>>>
>>> I've noticed that a couple temp files are leaked after each full
>>> gcc test-suite run.
>>>
>>> I'd like to fix that by the following patch.
>>>
>>>
>>> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
>>> Is it OK for trunk?
>>>
>> 
>> Thanks, looks reasonable to me.  Can you first post the patch upstream?
>> 
>> https://github.com/dlang/phobos/pulls
>> 
>> Just targeting the dmd-cxx branch is fine.  Then update
>> libdruntime/MERGE with the latest commit reference.
>> 
> 
> Okay, done, https://github.com/dlang/phobos/pull/8074 
> that merge was very fast indeed :-)
> 
> Will that PR be eventually pushed to the https://github.com/dlang/druntime
> as well, so I can update the libdruntime/MERGE with this commit-reference?
> 

Oops, sorry I meant src/MERGE, druntime has nothing to do with it.

So yes, please add 63f4caa900e17c541042617b2fa187059b86bf88 to
libphobos/src/MERGE and it's good to go.

Iain.
Bernd Edlinger May 14, 2021, 12:24 p.m. UTC | #4
On 5/14/21 1:54 PM, Iain Buclaw wrote:
> 
> Oops, sorry I meant src/MERGE, druntime has nothing to do with it.
> 
> So yes, please add 63f4caa900e17c541042617b2fa187059b86bf88 to
> libphobos/src/MERGE and it's good to go.
> 

Okay, so this is what I've pushed now:

commit cb787efa45782adab764575a2efc356e082828b6
Author: Bernd Edlinger <bernd.edlinger@hotmail.de>
Date:   Fri May 14 07:10:59 2021 +0200

    Cleanup temp files in libphobos unittest at src/std/process.d
    
    2021-05-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>
    
        * src/std/process.d (unittest): Remove tmpname on exit.
        * src/MERGE: Merge upstream phobos 63f4caa90.

diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE
index 49622c5..ac709f9 100644
--- a/libphobos/src/MERGE
+++ b/libphobos/src/MERGE
@@ -1,4 +1,4 @@
-32cfe9b61570d52d9885b0208fd20de0d351b51e
+63f4caa900e17c541042617b2fa187059b86bf88
 
 The first line of this file holds the git revision number of the last
 merge done from the dlang/phobos repository.
diff --git a/libphobos/src/std/process.d b/libphobos/src/std/process.d
index 63ec493..1e977aa 100644
--- a/libphobos/src/std/process.d
+++ b/libphobos/src/std/process.d
@@ -2581,6 +2581,7 @@ private auto executeImpl(alias pipeFunc, Cmd, ExtraPipeFuncArgs...)(
 
     ReturnType!executeShell r;
     auto tmpname = uniqueTempPath;
+    scope(exit) if (exists(tmpname)) remove(tmpname);
     auto t = stderr;
     // Open a new scope to minimize code ran with stderr redirected.
     {


Thanks
Bernd.
diff mbox series

Patch

From 6ad9e8552646e6ff54981cf7102ffcb311b6860f Mon Sep 17 00:00:00 2001
From: Bernd Edlinger <bernd.edlinger@hotmail.de>
Date: Fri, 14 May 2021 07:10:59 +0200
Subject: [PATCH] Cleanup temp files in libphobos unittest at src/std/process.d

2021-05-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* src/std/process.d (unittest): Remove tmpname on exit.
---
 libphobos/src/std/process.d | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libphobos/src/std/process.d b/libphobos/src/std/process.d
index 63ec493..1e977aa 100644
--- a/libphobos/src/std/process.d
+++ b/libphobos/src/std/process.d
@@ -2581,6 +2581,7 @@  private auto executeImpl(alias pipeFunc, Cmd, ExtraPipeFuncArgs...)(
 
     ReturnType!executeShell r;
     auto tmpname = uniqueTempPath;
+    scope(exit) if (exists(tmpname)) remove(tmpname);
     auto t = stderr;
     // Open a new scope to minimize code ran with stderr redirected.
     {
-- 
1.9.1