~ubuntu-branches/ubuntu/lucid/erlang/lucid

« back to all changes in this revision

Viewing changes to lib/kernel/src/os.erl

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-11-06 18:54:42 UTC
  • mfrom: (3.3.4 sid)
  • Revision ID: james.westby@ubuntu.com-20091106185442-bqxb11qghumvmvx2
Tags: 1:13.b.2.1-dfsg-1ubuntu1
* Merge with Debian testing; remaining Ubuntu changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to. (LP #438365)
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
    false.
71
71
 
72
72
verify_executable(Name0, [Ext|Rest]) ->
73
 
    Name1 = Name0++Ext,
 
73
    Name1 = Name0 ++ Ext,
74
74
    case os:type() of
75
75
        vxworks ->
76
76
            %% We consider all existing VxWorks files to be executable
118
118
reverse_element(List) ->
119
119
    lists:reverse(List).
120
120
 
 
121
-spec extensions() -> [string()].
121
122
extensions() ->
122
123
    case type() of
123
124
        {win32, _} -> [".exe",".com",".cmd",".bat"];
170
171
-define(SHELL, "/bin/sh -s unix:cmd 2>&1").
171
172
 
172
173
%%
173
 
%%  start_port() -> Port
174
 
%%
175
174
%% Serializing open_port through a process to avoid smp lock contention
176
175
%% when many concurrent os:cmd() want to do vfork (OTP-7890).
 
176
%%
 
177
-spec start_port() -> port().
177
178
start_port() ->
178
179
    {Ref,Client} = {make_ref(),self()},
179
180
    try (os_cmd_port_creator ! {Ref,Client})
184
185
        {Ref,Port} when is_port(Port) -> Port;
185
186
        {Ref,Error} -> exit(Error)
186
187
    end.
187
 
        
 
188
 
188
189
start_port_srv(Request) ->
189
190
    StayAlive = try register(os_cmd_port_creator, self())
190
191
                catch
208
209
        false -> exiting
209
210
    end.
210
211
 
211
 
 
212
 
 
213
212
%%
214
213
%%  unix_get_data(Port) -> Result
215
214
%%
221
220
        {Port,{data, Bytes}} ->
222
221
            case eot(Bytes) of
223
222
                {done, Last} ->
224
 
                    lists:flatten([Sofar| Last]);
 
223
                    lists:flatten([Sofar|Last]);
225
224
                more  ->
226
 
                    unix_get_data(Port, [Sofar| Bytes])
 
225
                    unix_get_data(Port, [Sofar|Bytes])
227
226
            end;
228
227
        {'EXIT', Port, _} ->
229
228
            lists:flatten(Sofar)