diff options
author | Henrik Nord <[email protected]> | 2014-03-21 16:39:02 +0100 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2014-03-21 16:39:05 +0100 |
commit | a4030a89eb9a22d250dba2793f274f8731126ea8 (patch) | |
tree | 620592b3560f98be67f71f70fd5596cc110ecd70 /lib/kernel/src/os.erl | |
parent | c9da6c2f06efa410462299a20e10206843082ac8 (diff) | |
parent | f43a1dc55d42de3097f75ca65baead9a2ff05c78 (diff) | |
download | otp-a4030a89eb9a22d250dba2793f274f8731126ea8.tar.gz otp-a4030a89eb9a22d250dba2793f274f8731126ea8.tar.bz2 otp-a4030a89eb9a22d250dba2793f274f8731126ea8.zip |
Merge branch 'fogfish/embedded-arm-android'
* fogfish/embedded-arm-android:
Raspberry PI / Android a minimal cross-compile configuration
OTP-11805
Diffstat (limited to 'lib/kernel/src/os.erl')
-rw-r--r-- | lib/kernel/src/os.erl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/kernel/src/os.erl b/lib/kernel/src/os.erl index 9ffa9adeab..3bda391b8e 100644 --- a/lib/kernel/src/os.erl +++ b/lib/kernel/src/os.erl @@ -230,7 +230,9 @@ unix_cmd(Cmd) -> %% and the commands are read from standard input. We set the %% $1 parameter for easy identification of the resident shell. %% --define(SHELL, "/bin/sh -s unix:cmd 2>&1"). +-define(ROOT, "/"). +-define(ROOT_ANDROID, "/system"). +-define(SHELL, "bin/sh -s unix:cmd 2>&1"). -define(PORT_CREATOR_NAME, os_cmd_port_creator). %% @@ -280,7 +282,12 @@ start_port_srv(Request) -> end. start_port_srv_handle({Ref,Client}) -> - Reply = try open_port({spawn, ?SHELL},[stream]) of + Path = case lists:reverse(erlang:system_info(system_architecture)) of + % androideabi + "ibaediordna" ++ _ -> filename:join([?ROOT_ANDROID, ?SHELL]); + _ -> filename:join([?ROOT, ?SHELL]) + end, + Reply = try open_port({spawn, Path},[stream]) of Port when is_port(Port) -> (catch port_connect(Port, Client)), unlink(Port), |