From 75763bd57338b3efe8300ece094aacc8e1a7a467 Mon Sep 17 00:00:00 2001
From: Dan Gudmundsson
Date: Mon, 25 Mar 2013 12:44:20 +0100
Subject: erts: Change erlang:open_port spawn to handle unicode
Previously only 'spawn_executable' handled unicode input.
Also change 'cd' option to always handle unicode.
Update open_port documentation and tests
---
erts/doc/src/erlang.xml | 66 +++++++++++++++++--------------------------------
1 file changed, 23 insertions(+), 43 deletions(-)
(limited to 'erts/doc')
diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml
index 5befd51974..81e9084e07 100644
--- a/erts/doc/src/erlang.xml
+++ b/erts/doc/src/erlang.xml
@@ -2613,7 +2613,28 @@ os_prompt%
Returns a port identifier as the result of opening a
new Erlang port. A port can be seen as an external Erlang
- process. PortName is one of the following:
+ process.
+
+ The name of the executable as well as the arguments
+ given in cd, env, args and arg0 is subject to
+ Unicode file name translation if the system is running
+ in Unicode file name mode. To avoid
+ translation or force i.e. UTF-8, supply the executable
+ and/or arguments as a binary in the correct
+ encoding. See the file module, the
+
+ file:native_name_encoding/0 function and the
+ stdlib users guide
+ for details.
+
+ The characters in the name (if given as a list)
+ can only be > 255 if the Erlang VM is started in
+ Unicode file name translation mode, otherwise the name
+ of the executable is limited to the ISO-latin-1
+ character set.
+
+ PortName is one of the following:
{spawn, Command}
-
@@ -2668,25 +2689,6 @@ os_prompt%
executed, the appropriate command interpreter will
implicitly be invoked, but there will still be no
command argument expansion or implicit PATH search.
-
-
The name of the executable as well as the arguments
- given in args and arg0 is subject to
- Unicode file name translation if the system is running
- in Unicode file name mode. To avoid
- translation or force i.e. UTF-8, supply the executable
- and/or arguments as a binary in the correct
- encoding. See the file module, the
-
- file:native_name_encoding/0 function and the
- stdlib users guide
- for details.
-
- The characters in the name (if given as a list)
- can only be > 255 if the Erlang VM is started in
- Unicode file name translation mode, otherwise the name
- of the executable is limited to the ISO-latin-1
- character set.
If the FileName cannot be run, an error
exception, with the posix error code as the reason, is
@@ -2762,11 +2764,7 @@ os_prompt%
strings. The one exception is Val being the atom
false (in analogy with os:getenv/1), which
removes the environment variable.
-
- If Unicode filename encoding is in effect (see the erl manual
- page), the strings (both Name and
- Value) may contain characters with codepoints > 255.
+
{args, [ string() | binary() ]}
-
@@ -2794,21 +2792,6 @@ os_prompt%
should not be given in this list. The proper executable name will
automatically be used as argv[0] where applicable.
-
When the Erlang VM is running in Unicode file name
- mode, the arguments can contain any Unicode characters and
- will be translated into whatever is appropriate on the
- underlying OS, which means UTF-8 for all platforms except
- Windows, which has other (more transparent) ways of
- dealing with Unicode arguments to programs. To avoid
- Unicode translation of arguments, they can be supplied as
- binaries in whatever encoding is deemed appropriate.
-
- The characters in the arguments (if given as a
- list of characters) can only be > 255 if the Erlang
- VM is started in Unicode file name mode,
- otherwise the arguments are limited to the
- ISO-latin-1 character set.
-
If one, for any reason, wants to explicitly set the
program name in the argument vector, the arg0
option can be used.
@@ -2824,9 +2807,6 @@ os_prompt%
responds to this is highly system dependent and no specific
effect is guaranteed.
- The unicode file name translation rules of the
- args option apply to this option as well.
-
exit_status
--
cgit v1.2.3