File tree Expand file tree Collapse file tree 1 file changed +4
-20
lines changed
src/repl_python_wakatime/hooks Expand file tree Collapse file tree 1 file changed +4
-20
lines changed Original file line number Diff line number Diff line change 4
4
Refer `create-plugin <https://wakatime.com/help/creating-plugin>`_.
5
5
"""
6
6
import os
7
- from subprocess import run # nosec: B404
8
- from threading import Thread
7
+ from subprocess import Popen # nosec: B404
9
8
from typing import Any , Callable
10
9
11
10
12
- def send_wakatime_heartbeat (
11
+ def wakatime_hook (
13
12
project : str = "" ,
14
13
category : str = "coding" ,
15
14
plugin : str = "repl-python-wakatime" ,
@@ -41,7 +40,7 @@ def send_wakatime_heartbeat(
41
40
from ..utils .project import get_project
42
41
43
42
project = get_project (filenames , detect_func )
44
- run ( # nosec: B603 B607
43
+ Popen ( # nosec: B603 B607
45
44
[
46
45
"wakatime-cli" ,
47
46
"--write" ,
@@ -51,20 +50,5 @@ def send_wakatime_heartbeat(
51
50
"--entity=python" ,
52
51
"--alternate-language=python" ,
53
52
f"--project={ project } " ,
54
- ],
55
- stdout = open (os .devnull , "w" ),
53
+ ]
56
54
)
57
-
58
-
59
- def wakatime_hook (* args : Any , ** kwargs : Any ) -> None :
60
- """Wakatime hook.
61
-
62
- :param args:
63
- :type args: Any
64
- :param kwargs:
65
- :type kwargs: Any
66
- :rtype: None
67
- """
68
- task = Thread (target = send_wakatime_heartbeat , args = args , kwargs = kwargs )
69
- task .daemon = True
70
- task .start ()
You can’t perform that action at this time.
0 commit comments