test/script/currently-failing/JDK-8006191.js

Fri, 05 Jun 2015 12:38:53 +0200

author
mhaupt
date
Fri, 05 Jun 2015 12:38:53 +0200
changeset 1398
2f1b9f4daec1
parent 962
ac62e33a99b0
child 1205
4112748288bb
permissions
-rw-r--r--

8080087: Nashorn $ENV.PWD is originally undefined
Summary: On Windows, the PWD environment variable does not exist and cannot be imported in scripting mode, so it is set explicitly.
Reviewed-by: lagergren, sundar

jlaskey@67 1 /*
jlaskey@67 2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
attila@962 3 *
jlaskey@67 4 * Redistribution and use in source and binary forms, with or without
jlaskey@67 5 * modification, are permitted provided that the following conditions
jlaskey@67 6 * are met:
attila@962 7 *
jlaskey@67 8 * - Redistributions of source code must retain the above copyright
jlaskey@67 9 * notice, this list of conditions and the following disclaimer.
attila@962 10 *
jlaskey@67 11 * - Redistributions in binary form must reproduce the above copyright
jlaskey@67 12 * notice, this list of conditions and the following disclaimer in the
jlaskey@67 13 * documentation and/or other materials provided with the distribution.
attila@962 14 *
jlaskey@67 15 * - Neither the name of Oracle nor the names of its
jlaskey@67 16 * contributors may be used to endorse or promote products derived
jlaskey@67 17 * from this software without specific prior written permission.
attila@962 18 *
jlaskey@67 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
jlaskey@67 20 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
jlaskey@67 21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
jlaskey@67 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
jlaskey@67 23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
jlaskey@67 24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
jlaskey@67 25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
jlaskey@67 26 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
jlaskey@67 27 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
jlaskey@67 28 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
jlaskey@67 29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
jlaskey@67 30 */
attila@962 31
jlaskey@67 32 /**
jlaskey@67 33 * JDK-8006191 - `cmd` -> exec("cmd") in script mode
jlaskey@67 34 *
jlaskey@67 35 * @test
jlaskey@67 36 * @option -scripting
jlaskey@67 37 * @argument ArgumentFromCommandLine
attila@962 38 * @run
jlaskey@67 39 */
jlaskey@67 40
jlaskey@67 41 #!/usr/bin/jjs
jlaskey@67 42
jlaskey@67 43 $ENV.PWD = ".";
jlaskey@67 44 print($ENV.PWD);
jlaskey@67 45
jlaskey@67 46 var files = `ls`.trim().split("\n");
jlaskey@67 47 for (var i in files) {
jlaskey@67 48 var file = files[i];
jlaskey@67 49 if (file.contains("README")) {
jlaskey@67 50 print(file);
jlaskey@67 51 }
jlaskey@67 52 }
jlaskey@67 53
jlaskey@67 54 var result = $EXEC("cat", <<EOD);
jlaskey@67 55 This is a bunch of stuff
jlaskey@67 56 that I want written out
jlaskey@67 57 including ${$ARG[0]}
jlaskey@67 58 EOD
jlaskey@67 59 print(result);
jlaskey@67 60 print($OUT);
jlaskey@67 61
jlaskey@67 62 var arg = "-Q";
jlaskey@67 63 `ls ${arg}`;
jlaskey@67 64 print($ERR);
jlaskey@67 65 print($EXIT);

mercurial