Skip to content

Commit 055dcdd

Browse files
committed
Add Base.set_process_title, Base.get_process_title
Not exported. Fixes #9957.
1 parent 5a4e1f8 commit 055dcdd

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

NEWS.md

+2
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ Library improvements
165165

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

168+
* Added Base.get_process_title / Base.set_process_title. ([#9957])
169+
168170
Deprecated or removed
169171
---------------------
170172

base/util.jl

+11
Original file line numberDiff line numberDiff line change
@@ -262,3 +262,14 @@ function julia_cmd(julia=joinpath(JULIA_HOME, "julia"))
262262
end
263263

264264
julia_exename() = ccall(:jl_is_debugbuild,Cint,())==0 ? "julia" : "julia-debug"
265+
266+
function get_process_title()
267+
buf = zeros(Uint8, 512)
268+
err = ccall(:uv_get_process_title, Cint, (Ptr{Uint8}, Cint), buf, 512)
269+
uv_error("get_process_title", err)
270+
bytestring(pointer(buf))
271+
end
272+
function set_process_title(title::AbstractString)
273+
err = ccall(:uv_set_process_title, Cint, (Ptr{UInt8},), bytestring(title))
274+
uv_error("set_process_title", err)
275+
end

doc/stdlib/base.rst

+8
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,14 @@ System
621621
and waits for the process to complete. Returns the value returned
622622
by ``f``.
623623

624+
.. function:: Base.set_process_title(title::AbstractString)
625+
626+
Set the process title. No-op on some operating systems. (not exported)
627+
628+
.. function:: Base.get_process_title()
629+
630+
Get the process title. On some systems, will always return empty string. (not exported)
631+
624632
.. function:: readandwrite(command)
625633

626634
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.

0 commit comments

Comments
 (0)