问题标签 [terminate]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
4 回答
65071 浏览

php - PHP - 退出或返回哪个更好?

我想知道在以下情况下哪个是更好的选择:

在PHP脚本中,如果$fileSize变量大于100,我就停止脚本;

案例一:

案例二:

案例三:

以上三 (3) 个选项中哪一个是最好的?

0 投票
2 回答
97 浏览

c++ - 是否可以输入 terminate_handler 两次?

我在 terminate_handler 中进行了一些清理,并且有可能引发异常。我是否需要担心捕获它以防止对 terminate_handler 的递归调用?使用 gcc,这似乎不可能发生,我们只是进入中止。标准是这样还是行为未定义?

0 投票
3 回答
369 浏览

android - 停止活动并提醒用户的最佳方式是什么?

我有一个必须创建数据库的应用程序,如果失败了,那么前进就没有意义了。我已经建立了一个 AlertDialog 和show()它,但它从不显示。由于缺少数据库,逻辑失败然后失败。

抛出消息并停止活动的正确/最佳方式是什么?下面的代码执行得很好(意味着show()在调试时发生并且它落到下一行),但 UI 从未显示此警报。顺便说一句 - 我意识到投掷可能不是最优雅的,但我什至没有走那么远...... B^)。

0 投票
1 回答
141 浏览

objective-c - 为什么我的应用程序在单元测试过程中终止?

问题

我运行我的单元测试。在某一时刻,我等待使用:

NSOperationQueue 为空。当我的应用程序到达这条线时,它会立即终止。它与其他测试运行完全相同的行。最近所有测试都运行良好。它有时也会在启动时立即终止我的应用程序。

到底是怎么回事?

0 投票
1 回答
3153 浏览

multithreading - OpenMP : Is there a way for a thread to terminate all other parallel threads?

I am experimenting with openMP for large data processing and relatively new to it. My input data set is huge and so I divided it into multiple subsets and each thread working on the subset of data. Each data item in the subset is acted up on by the thread. If one of the threads fails during its operation on any dataitem, i would like to terminate other threads and return a failure. Using shared variable is an option, but is there a better way to do the same ?

0 投票
3 回答
4737 浏览

bash - 调用“exit”时,Bash 脚本不会立即退出

我有以下 bash 脚本:

由于某种原因,它正在回显launchd message,等待整整 5 秒,然后退出。

为什么会发生这种情况,如何让它在回显后立即退出launchd message

0 投票
1 回答
1915 浏览

process - Hooking TerminateProcess & Getting Info From The Handle It Supplies

If you want to stop a process from being terminated, one way is to hook into TerminateProcess (or NtTerminateProcess). If the process is terminating itself (because you closed its window, for example), the handle supplied to those functions is NULL, so you can find out what executable is being terminated using GetCurrentProcess() & GetModuleFileNameEx(). As GetCurrentProcess() returns a pseudo-handle, you can access it with no problems.

If one process is terminating another, though, the handle supplied is not NULL. It represents the process being terminated. The problem is, you can't get information about that process. You can simply return a code saying "access denied" instead of calling the original [Nt]TerminateProcess(), but that blanket stops all processes from terminating others - which is a bad idea.

The handle must represent something valid otherwise TerminateProcess wouldn't be able to do anything useful with it - but I can't even call GetProcessId() on it, I get ERROR_INVALID_HANDLE (or ERROR_ACCESS_DENIED). I've tried various methods I've collected from the help and from online, including gaining the debug privilege (success) and DuplicateHandle() (same error) and ZwQueryInformationProcess() to get the ID (STATUS_ACCESS_DENIED). I can't even enumerate processes because they return IDs, and I can't get the ID, and OpenProcess() always returns a fresh handle, so I can't compare handles.

I can only assume the handle has PROCESS_TERMINATE right and nothing else. I know that Vista and higher have protected processes due to Digital Rights Management, but I'm using ProcessExplorer as my guinea pig so it's definitely not a media application!

Does anyone know how else I might be able to get any kind of information about the process being terminated from this handle?

0 投票
2 回答
440 浏览

python - Python脚本打开一个bash提示终止脚本

我想在 python 中编写一个 chroot 包装器。该脚本将复制一些文件,设置一些其他内容,然后执行 chroot,并且应该让我进入 chroot shell。

棘手的部分是我不想在进入 chroot 后运行任何 python 进程。

换句话说,python 应该完成设置工作,调用 chroot 并自行终止,将我留在 chroot shell 中。当我退出 chroot 时,我应该在我调用 python 脚本时所在的目录中。

这可能吗?

0 投票
2 回答
3039 浏览

objective-c - 抛出“NSException”错误实例后调用终止

你能帮帮我吗,我的应用程序运行良好,但是当我对其进行修改时,(我不记得是什么样的修改)我在控制台中收到了这条消息:

) 在抛出 'NSException' 的实例后调用终止

请帮我!!

0 投票
2 回答
237 浏览

jquery - 如何终止 Jquery setIntereval?

我正在尝试终止刷新我的页面的 setIntreval。但是 cleareIntreval() 对我不起作用。

我有

当我单击按钮时,我使用 clearInterval($chatInterval); But 表示 $chatInterval 未定义。是的,它们在不同的函数范围内。如何声明公共变量 setInterval?