Skip to content

Commit

Permalink
Orphan processes (#35)
Browse files Browse the repository at this point in the history
* fix : tests modified

* fix : tests modified

* fix : minor bug in tests fixed

* fix : tests modified

* fix : tests modified

* fix : tests modified

* fix : tests modified

* fix : NavaThread stop method bug fixed

* doc : CHANGELOG.md updated

* fix : tests updated
  • Loading branch information
sepandhaghighi authored Feb 8, 2024
1 parent 3af01b4 commit cf9e195
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Changed
- `NavaThread.stop` method bug fixed
## [0.3] - 2024-01-31
### Added
- `NavaThread` class
Expand Down
4 changes: 4 additions & 0 deletions nava/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,9 @@ def stop(self):
winsound.PlaySound(None, winsound.SND_PURGE)
else:
if self.play_process is not None:
self.play_process.stdout.close()
self.play_process.stdin.close()
self.play_process.stderr.close()
self.play_process.kill()
self.play_process.terminate()
self.play_process.wait()
5 changes: 5 additions & 0 deletions test/function_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
"""
>>> import os
>>> import time
>>> from nava import play, stop, stop_all
>>> play(os.path.join("others", "test.wav"))
>>> sound_id_1 = play(os.path.join("others", "test.wav"), async_mode=True)
Expand All @@ -14,6 +15,10 @@
True
>>> stop(1001)
>>> stop_all()
>>> for i in range(40):
... sound_id = play(os.path.join("others", "test.wav"), async_mode=True)
... time.sleep(0.5)
... stop(sound_id)
>>> from nava.functions import nava_help
>>> nava_help()
<BLANKLINE>
Expand Down

0 comments on commit cf9e195

Please sign in to comment.