Skip to content

Instantly share code, notes, and snippets.

@aji

aji/repro.py Secret

Created August 23, 2015 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aji/73ee59d09124fd055099 to your computer and use it in GitHub Desktop.
Save aji/73ee59d09124fd055099 to your computer and use it in GitHub Desktop.
script to reproduce weechat github issue #406
import weechat
COUNTER = 0
def decrease_counter(*args, **kwargs):
global COUNTER
if COUNTER > 0:
COUNTER -= 1
if COUNTER == 0:
weechat.prnt('', 'All processes finished')
return weechat.WEECHAT_RC_OK
def issue406(*args, **kwargs):
global COUNTER
COUNTER += 1
weechat.hook_process('false', 0, 'decrease_counter', '')
return weechat.WEECHAT_RC_OK
def issue406url(*args, **kwargs):
global COUNTER
COUNTER += 1
weechat.hook_process('url:http://127.0.0.1:34567', 0, 'decrease_counter', '')
return weechat.WEECHAT_RC_OK
weechat.register('repro', 'aji', '1.0', 'MIT', 'github issue #406', '', '')
weechat.hook_command('issue406', 'github issue #406', '', '', '', 'issue406', '')
weechat.hook_command('issue406url', 'github issue #406 url',
'', '', '', 'issue406url', '')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment