176 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
17
votes
1
answer
1k
views
100% coverage exit handler that handles all ways a program can exit in C
I have a program where I allocated a lot of data and used multiple libraries. I have a cleanup procedure (can be a function, label, setjmp, or just a section of code) that frees allocated memory and ...
2
votes
1
answer
46
views
subprocess.Popen batch file wont delete on force terminate
I want to run a batch file using subprocess.Popen ... then delete the batch file if I force exit (the red square STOP button in pycharm)
with open('test.bat', "w", encoding='utf-8') as a: a....
0
votes
1
answer
99
views
Python, Proper Thread Closing at Program Exit
I am having a problem when trying to do resource cleanup in a background thread. The code running in the thread is meant to run indefinitely or until it is stopped and then cleanup is done. I could ...
0
votes
1
answer
59
views
Execute a last line of code when the user closes the console window
If we run a Python program in a console on Windows (python myscript.py), is there a possibility to run a last line of code when the user clicks on the "X" top-right button of the console ...
0
votes
1
answer
314
views
Joining a thread started by a DLL prior to program termination on Windows
Background
I am using the miniaudio library to implement the audio module in the open-source SFML 3.x library.
As an attempt to simplify our audio resource management, I removed run-time reference ...
0
votes
1
answer
135
views
Python shutil.copytree: [WinError 32] The process cannot access the file because it is being used by another process
On GitHub I share an PyInstaller generated exe-File (file1.exe). The idea is an automatized update process if there is a new version of the file. On every start of file1.exe the program checks if ...
0
votes
0
answers
95
views
Is there a way to make sure your std::atexit function works when stopping the Xcode debugger?
Found that when you halt your C++ program from Xcode using "Stop Debugging", your atexit function gets skipped
Any way to do this, especially when debugging an iOS app?
0
votes
1
answer
105
views
Unable to delete table from AstraDb when closing Flask app using atexit()
app = Flask(__name__)
# AstraDB connection and vector store initialization
def initialize_astra_vector_store():
cassio.init(token=ASTRA_DB_APPLICATION_TOKEN, database_id=ASTR_DB_ID)
...
0
votes
1
answer
139
views
atexit registered function unable to access streamlit session state variable
I have registered an atexit function like this:
import streamlit as st
from azure.search.documents.indexes import SearchIndexClient
from azure.core.credentials import AzureKeyCredential
@atexit....
-1
votes
1
answer
98
views
How can I fix a RuntimeWarning using the 'atexit' module?
Recently, I've been wanting to create an exit handler for my discord bot which sends an embed every time it goes offline.
I found out through some quick research about the atexit module.
I tried to ...
0
votes
1
answer
110
views
WinAPI - how to run some clean up code on forceful exit
I have this snippet:
#include <windows.h>
class Conf {
public:
Conf(int i) : m_i{ i } {
MessageBoxA(NULL, "Conf", "", MB_OK);
}
~...
1
vote
0
answers
202
views
atexit module not working when stopped with vsCode
I am coding a discord bot in discord.py. I want it to change the role of the bot to show it's offline when the code is stopped. Here's the relevant code:
import atexit, signal
class MyClient(discord....
0
votes
1
answer
169
views
Why does callback not called which is defined with @atexit.register at sys.exit in Python? [duplicate]
Description:
I wonder that why does callback not called which is defined with @atexit.register at sys.exit in Python?
Code 1:
import atexit
import sys
if __name__ == '__main__':
@atexit.register
...
1
vote
3
answers
241
views
atexit(3) in Perl: `END {}` or `$SIG{__DIE__}`?
I'm wondering: When you detect you need to clean up at the end of the program (excluding "end of block"), you want to "queue an exit handler" that does the cleanup at some later ...
4
votes
0
answers
51
views
Register a callback to handle JLI_Launch failing with "Could not find or load main class"
I am trying to make AppBundler more observable and have had great success except for one thing. JLI_Launch does not return to the caller so I can't tell if it fails to load the main class (or any ...