Skip to content

Commit 39f1158

Browse files
committed
Merge pull request #463 from ThomasJClark/java-args
Automatically kill existing instances of GRIP from the wrapper
2 parents 0567f82 + dacb148 commit 39f1158

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ui/src/main/java/edu/wpi/grip/ui/DeployController.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,11 @@ public StreamCopier.Listener file(String name, long size) {
180180

181181
// Upload the project file and a wrapper script with the JVM arguments. These are very small and change
182182
// often, so we might as well upload them every time.
183-
scp.upload(new StringInMemoryFile(GRIP_WRAPPER, "echo \"" + commandStr + "\"\n" + commandStr, 0755), pathStr);
183+
scp.upload(new StringInMemoryFile(GRIP_WRAPPER,
184+
"PID=$(ps aux | grep " + GRIP_JAR + "| grep -v grep | awk '{print $1}')\n"
185+
+ "if [ $PID ]; then kill -9 $PID; fi\n"
186+
+ "echo \"" + commandStr + "\"\n"
187+
+ commandStr, 0755), pathStr);
184188
scp.upload(new StringInMemoryFile(projectFile.getText(), projectWriter.toString()), pathStr);
185189

186190
// Stop the pipeline before running it remotely, so the two instances of GRIP don't try to publish to the

0 commit comments

Comments
 (0)