changeset 49551:d958597c7908

8200706: Better cleanup for open/test/jdk/java/lang/ProcessBuilder/DestroyTest.java Reviewed-by: psandoz, lancea
author rriggs
date Fri, 06 Apr 2018 12:49:23 -0400
parents 2d5d75263e77
children 5556e9c1e681
files test/jdk/java/lang/ProcessBuilder/DestroyTest.java
diffstat 1 files changed, 11 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/java/lang/ProcessBuilder/DestroyTest.java	Fri Apr 06 09:15:09 2018 -0400
+++ b/test/jdk/java/lang/ProcessBuilder/DestroyTest.java	Fri Apr 06 12:49:23 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -145,18 +145,16 @@
         String osName = System.getProperty("os.name");
         if (osName.startsWith("Windows")) {
             return new WindowsTest();
-        } else if (osName.startsWith("Linux") == true) {
-            return new UnixTest(
-                File.createTempFile("ProcessTrap-", ".sh",null));
-        } else if (osName.startsWith("Mac OS")) {
-            return new MacTest(
-                File.createTempFile("ProcessTrap-", ".sh",null));
-        } else if (osName.equals("SunOS")) {
-            return new UnixTest(
-                File.createTempFile("ProcessTrap-", ".sh",null));
-        } else if (osName.equals("AIX")) {
-            return new UnixTest(
-                File.createTempFile("ProcessTrap-", ".sh",null));
+        } else {
+            File userDir = new File(System.getProperty("user.dir", "."));
+            File tempFile = File.createTempFile("ProcessTrap-", ".sh", userDir);
+            if (osName.startsWith("Linux") == true
+                    || osName.equals("SunOS")
+                    || osName.equals("AIX")) {
+                return new UnixTest(tempFile);
+            } else if (osName.startsWith("Mac OS")) {
+                return new MacTest(tempFile);
+            }
         }
         return null;
     }