Skip to content

Commit 26a8e1d

Browse files
committed
Makes the kill happen properly before deploying
Stops double code running, and closes #22
1 parent eb582e7 commit 26a8e1d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

FRC-Extension/RoboRIOCode/DeployManager.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,17 +312,22 @@ public async Task UploadCode(string robotName, SettingsPageGrid page, bool debug
312312

313313
string args = GetCommandLineArguments(robotProject);
314314

315-
//Must be run as admin, so is seperate
316-
await RoboRIOConnection.RunCommand("killall -q netconsole-host || :", ConnectionUser.Admin);
315+
//Kill the currently running robot program
316+
await RoboRIOConnection.RunCommand(DeployProperties.KillOnlyCommand, ConnectionUser.LvUser);
317317

318318
//Combining all other commands, since they should be safe running together.
319319
List<string> commands = new List<string>();
320+
321+
//Write the robotCommand file
320322
commands.Add($"echo {deployedCmd} {args} > {DeployProperties.CommandDir}/{deployedCmdFrame}");
321323
if (debug)
322324
{
325+
//If debug write the debug flag.
323326
commands.AddRange(DeployProperties.DebugFlagCommand);
324327
}
328+
//Add all commands to restart
325329
commands.AddRange(DeployProperties.DeployKillCommand);
330+
//run all commands
326331
await RoboRIOConnection.RunCommands(commands.ToArray(), ConnectionUser.LvUser);
327332

328333
//Run sync so files are written to disk.

FRC-Extension/RoboRIOCode/DeployProperties.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static class DeployProperties
1616
". /etc/profile.d/natinst-path.sh; /usr/local/frc/bin/frcKillRobot.sh -t -r;",
1717
};
1818

19-
public const string KillOnlyCommand = "/usr/local/frc/bin/frcKillRobot.sh -t";
19+
public const string KillOnlyCommand = ". /etc/profile.d/natinst-path.sh; /usr/local/frc/bin/frcKillRobot.sh -t";
2020

2121
public const string DebugFlagDir = "/tmp/";
2222

0 commit comments

Comments
 (0)