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 44Refer `create-plugin <https://wakatime.com/help/creating-plugin>`_.
55"""
66import os
7- from subprocess import run # nosec: B404
8- from threading import Thread
7+ from subprocess import Popen # nosec: B404
98from typing import Any , Callable
109
1110
12- def send_wakatime_heartbeat (
11+ def wakatime_hook (
1312 project : str = "" ,
1413 category : str = "coding" ,
1514 plugin : str = "repl-python-wakatime" ,
@@ -41,7 +40,7 @@ def send_wakatime_heartbeat(
4140 from ..utils .project import get_project
4241
4342 project = get_project (filenames , detect_func )
44- run ( # nosec: B603 B607
43+ Popen ( # nosec: B603 B607
4544 [
4645 "wakatime-cli" ,
4746 "--write" ,
@@ -51,20 +50,5 @@ def send_wakatime_heartbeat(
5150 "--entity=python" ,
5251 "--alternate-language=python" ,
5352 f"--project={ project } " ,
54- ],
55- stdout = open (os .devnull , "w" ),
53+ ]
5654 )
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