Skip to content

Commit

Permalink
Add Base.set_process_title, Base.get_process_title
Browse files Browse the repository at this point in the history
Not exported. Fixes #9957.
  • Loading branch information
ihnorton committed Jan 30, 2015
1 parent 5a4e1f8 commit 055dcdd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ Library improvements

* Rational arithmetic throws errors on overflow ([#8672]).

* Added Base.get_process_title / Base.set_process_title. ([#9957])

Deprecated or removed
---------------------

Expand Down
11 changes: 11 additions & 0 deletions base/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,14 @@ function julia_cmd(julia=joinpath(JULIA_HOME, "julia"))
end

julia_exename() = ccall(:jl_is_debugbuild,Cint,())==0 ? "julia" : "julia-debug"

function get_process_title()
buf = zeros(Uint8, 512)
err = ccall(:uv_get_process_title, Cint, (Ptr{Uint8}, Cint), buf, 512)
uv_error("get_process_title", err)
bytestring(pointer(buf))
end
function set_process_title(title::AbstractString)
err = ccall(:uv_set_process_title, Cint, (Ptr{UInt8},), bytestring(title))
uv_error("set_process_title", err)
end
8 changes: 8 additions & 0 deletions doc/stdlib/base.rst
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,14 @@ System
and waits for the process to complete. Returns the value returned
by ``f``.

.. function:: Base.set_process_title(title::AbstractString)

Set the process title. No-op on some operating systems. (not exported)

.. function:: Base.get_process_title()

Get the process title. On some systems, will always return empty string. (not exported)

.. function:: readandwrite(command)

Starts running a command asynchronously, and returns a tuple (stdout,stdin,process) of the output stream and input stream of the process, and the process object itself.
Expand Down

2 comments on commit 055dcdd

@JeffBezanson
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe should go in Sys?

@ihnorton
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 411a0d8

Please sign in to comment.