mirror of
https://github.com/janet-lang/janet
synced 2025-06-23 17:04:11 +00:00
Add os/getpid
This commit is contained in:
parent
b12dfd784e
commit
a9ff8b388f
@ -4466,7 +4466,7 @@
|
|||||||
|
|
||||||
(defn bundle/add
|
(defn bundle/add
|
||||||
"Add files and directories during a bundle install relative to `(dyn *syspath*)`.
|
"Add files and directories during a bundle install relative to `(dyn *syspath*)`.
|
||||||
Added paths will be recorded in the bundle manifest such that they are properly tracked
|
Added files and directories will be recorded in the bundle manifest such that they are properly tracked
|
||||||
and removed during an upgrade or uninstall."
|
and removed during an upgrade or uninstall."
|
||||||
[manifest src &opt dest chmod-mode]
|
[manifest src &opt dest chmod-mode]
|
||||||
(default dest src)
|
(default dest src)
|
||||||
|
@ -813,6 +813,18 @@ JANET_CORE_FN(os_proc_close,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JANET_CORE_FN(os_proc_getpid,
|
||||||
|
"(os/getpid)",
|
||||||
|
"Get the process ID of the current process.") {
|
||||||
|
janet_fixarity(argc, 0);
|
||||||
|
(void) argv;
|
||||||
|
#ifdef JANET_WINDOWS
|
||||||
|
return janet_wrap_number((double) _getpid());
|
||||||
|
#else
|
||||||
|
return janet_wrap_number((double) getpid());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static void swap_handles(JanetHandle *handles) {
|
static void swap_handles(JanetHandle *handles) {
|
||||||
JanetHandle temp = handles[0];
|
JanetHandle temp = handles[0];
|
||||||
handles[0] = handles[1];
|
handles[0] = handles[1];
|
||||||
@ -2797,6 +2809,7 @@ void janet_lib_os(JanetTable *env) {
|
|||||||
JANET_CORE_REG("os/proc-wait", os_proc_wait),
|
JANET_CORE_REG("os/proc-wait", os_proc_wait),
|
||||||
JANET_CORE_REG("os/proc-kill", os_proc_kill),
|
JANET_CORE_REG("os/proc-kill", os_proc_kill),
|
||||||
JANET_CORE_REG("os/proc-close", os_proc_close),
|
JANET_CORE_REG("os/proc-close", os_proc_close),
|
||||||
|
JANET_CORE_REG("os/getpid", os_proc_getpid),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* high resolution timers */
|
/* high resolution timers */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user