Go to the documentation of this file.00001 """
00002 The run command runs a command remotely on a robot.
00003
00004 Copyright 2015 Fetch Robotics Inc.
00005 Author: Alex Henning
00006 """
00007
00008 import sys
00009
00010 from ..util import ssh, add_user, add_robot, add_workspace
00011
00012 name = "run"
00013 help_text = "Run a command on the robot"
00014
00015
00016 def main(args):
00017 print "%s@%s$ %s" % (args.user, args.robot, args.command)
00018 if ssh(args.user, args.robot,
00019 "source "+args.remote_workspace+"/devel/setup.bash && "+args.command) != 0:
00020 print "ERROR: Command crashed"
00021 sys.exit(-1)
00022
00023
00024 def add_arguments(parser):
00025 add_user(parser)
00026 add_robot(parser)
00027 add_workspace(parser)
00028 parser.add_argument("command", action="store", default="bash",
00029 help="Command and args to run remotely")