Package buildslave :: Package commands :: Module shell
[frames] | no frames]

Source Code for Module buildslave.commands.shell

 1  # This file is part of Buildbot.  Buildbot is free software: you can 
 2  # redistribute it and/or modify it under the terms of the GNU General Public 
 3  # License as published by the Free Software Foundation, version 2. 
 4  # 
 5  # This program is distributed in the hope that it will be useful, but WITHOUT 
 6  # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
 7  # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
 8  # details. 
 9  # 
10  # You should have received a copy of the GNU General Public License along with 
11  # this program; if not, write to the Free Software Foundation, Inc., 51 
12  # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
13  # 
14  # Copyright Buildbot Team Members 
15   
16  import os 
17   
18  from buildslave.commands import base 
19  from buildslave import runprocess 
20   
21 -class SlaveShellCommand(base.Command):
22 - def start(self):
23 args = self.args 24 # args['workdir'] is relative to Builder directory, and is required. 25 assert args['workdir'] is not None 26 workdir = os.path.join(self.builder.basedir, args['workdir']) 27 28 c = runprocess.RunProcess( 29 self.builder, 30 args['command'], 31 workdir, 32 environ=args.get('env'), 33 timeout=args.get('timeout', None), 34 maxTime=args.get('maxTime', None), 35 sendStdout=args.get('want_stdout', True), 36 sendStderr=args.get('want_stderr', True), 37 sendRC=True, 38 initialStdin=args.get('initial_stdin'), 39 logfiles=args.get('logfiles', {}), 40 usePTY=args.get('usePTY', "slave-config"), 41 logEnviron=args.get('logEnviron', True), 42 ) 43 if args.get('interruptSignal'): 44 c.interruptSignal = args['interruptSignal'] 45 c._reactor = self._reactor 46 self.command = c 47 d = self.command.start() 48 return d
49
50 - def interrupt(self):
51 self.interrupted = True 52 self.command.kill("command interrupted")
53
54 - def writeStdin(self, data):
55 self.command.writeStdin(data)
56
57 - def closeStdin(self):
58 self.command.closeStdin()
59