From 1b6f1f04eccf3ef862aabf3b5c81763c95b6c3b7 Mon Sep 17 00:00:00 2001 From: nyuszika7h Date: Sun, 3 Feb 2013 14:12:21 +0100 Subject: [PATCH 1/3] supybot-botchk: Fix Python 3 compatibility --- scripts/supybot-botchk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/supybot-botchk b/scripts/supybot-botchk index ff9ed0908..186f72e29 100644 --- a/scripts/supybot-botchk +++ b/scripts/supybot-botchk @@ -132,7 +132,7 @@ if __name__ == '__main__': inst.stdin.write('source %s' % filename + os.linesep) cmdline = '%s --daemon %s' % (options.supybot, options.conffile) debug('Sending cmdline to sh process.') - inst.stdin.write(cmdline + os.linesep) + inst.stdin.write(cmdline.encode('utf-8') + os.linesep.encode('utf-8')) inst.stdin.close() debug('Received from sh process: %r' % inst.stdout.read()) ret = inst.wait() From 7edc73a08c142965efffd50d6c7a465ec1c39306 Mon Sep 17 00:00:00 2001 From: nyuszika7h Date: Sun, 3 Feb 2013 14:15:46 +0100 Subject: [PATCH 2/3] supybot-botchk: Use open() and close() instead of os.system('touch') --- scripts/supybot-botchk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/supybot-botchk b/scripts/supybot-botchk index 186f72e29..ef101b690 100644 --- a/scripts/supybot-botchk +++ b/scripts/supybot-botchk @@ -97,7 +97,8 @@ if __name__ == '__main__': parser.error('No conffile given.') os.chdir(options.botdir) - os.system('touch %s' % options.pidfile) + pidfile = open(options.pidfile, 'w') + pidfile.close() pid = None try: From 658d0ad84dc8d7948c048117a6512dbec94e4b39 Mon Sep 17 00:00:00 2001 From: nyuszika7h Date: Sun, 3 Feb 2013 14:20:16 +0100 Subject: [PATCH 3/3] supybot-botchk: Don't truncate pidfile --- scripts/supybot-botchk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/supybot-botchk b/scripts/supybot-botchk index ef101b690..de6e4e802 100644 --- a/scripts/supybot-botchk +++ b/scripts/supybot-botchk @@ -97,7 +97,7 @@ if __name__ == '__main__': parser.error('No conffile given.') os.chdir(options.botdir) - pidfile = open(options.pidfile, 'w') + pidfile = open(options.pidfile, 'ab') pidfile.close() pid = None