从正在运行的进程中分离 [英] Detach from running process

查看:80
本文介绍了从正在运行的进程中分离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我面临一个有趣的情况:

I am facing a funny situation:

我正在开发一个 flashlight 插件,以便在未来的某个时间触发警报.

I'm developing a flashlight plugin to trigger an alarm at some point in the future.

问题是,手电筒在 30 秒后杀死了脚本.所以我既不能等待足够长的时间来激活闹钟,也不能无限期地播放闹钟,直到用户取消它.

The problem is, flashlight kills the script after 30 seconds. So I can neither wait long enough to activate the alarm nor play the alarm indefinitely until the user cancels it.

因此,我正在寻找一种方法,让脚本将自身与其父进程分离"(或以其他方式防止其被其父进程杀死.

So, I am looking to find a way for the script to "detach" itself from (or otherwise prevent itself from being killed by) its parent process.

这可以通过守护进程来实现吗?

Could this be accomplished by daemonising itself?

推荐答案

我相信您正在寻找的术语是fork",例如在 os 库中找到的那个.

I believe the term you are looking for is "fork", such as the one found in the os library.

这篇关于从正在运行的进程中分离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆