aboutsummaryrefslogtreecommitdiffstats
path: root/lib/runtime_tools/src/observer_backend.erl
diff options
context:
space:
mode:
authorAndrzej Telezynski <[email protected]>2011-07-21 13:08:28 +0200
committerHenrik Nord <[email protected]>2011-08-30 15:22:19 +0200
commit2d319d3fcdc9bf7b8ac7d389ce5ee0a38645882f (patch)
tree779cfe9868ad88c8d93110370d816bb31ca949a2 /lib/runtime_tools/src/observer_backend.erl
parent4e3b8ccfa74785ca78f70e4d745c123037aada7f (diff)
downloadotp-2d319d3fcdc9bf7b8ac7d389ce5ee0a38645882f.tar.gz
otp-2d319d3fcdc9bf7b8ac7d389ce5ee0a38645882f.tar.bz2
otp-2d319d3fcdc9bf7b8ac7d389ce5ee0a38645882f.zip
It is safe to change cwd on control node or remote nodes while tracing
Diffstat (limited to 'lib/runtime_tools/src/observer_backend.erl')
-rw-r--r--lib/runtime_tools/src/observer_backend.erl14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/runtime_tools/src/observer_backend.erl b/lib/runtime_tools/src/observer_backend.erl
index 0f428de07a..39d54bf782 100644
--- a/lib/runtime_tools/src/observer_backend.erl
+++ b/lib/runtime_tools/src/observer_backend.erl
@@ -92,13 +92,15 @@ etop_collect([], Acc) -> Acc.
%%
%% ttb backend
%%
-ttb_init_node(MetaFile,PI,Traci) ->
+ttb_init_node(MetaFile_0,PI,Traci) ->
if
- is_list(MetaFile);
- is_atom(MetaFile) ->
+ is_list(MetaFile_0);
+ is_atom(MetaFile_0) ->
+ {ok, Cwd} = file:get_cwd(),
+ MetaFile = filename:join(Cwd, MetaFile_0),
file:delete(MetaFile);
true -> % {local,_,_}
- ok
+ MetaFile = MetaFile_0
end,
Self = self(),
MetaPid = spawn(fun() -> ttb_meta_tracer(MetaFile,PI,Self) end),
@@ -111,7 +113,7 @@ ttb_init_node(MetaFile,PI,Traci) ->
false ->
ok
end,
- {ok,MetaPid}.
+ {ok,MetaFile,MetaPid}.
ttb_write_trace_info(MetaPid,Key,What) ->
MetaPid ! {metadata,Key,What},
@@ -287,7 +289,7 @@ ttb_fetch(MetaFile,{Port,Host}) ->
send_files({Sock,Host},[File|Files]) ->
{ok,Fd} = file:open(File,[raw,read,binary]),
- gen_tcp:send(Sock,<<1,(list_to_binary(File))/binary>>),
+ gen_tcp:send(Sock,<<1,(list_to_binary(filename:basename(File)))/binary>>),
send_chunks(Sock,Fd),
file:delete(File),
send_files({Sock,Host},Files);