Skip to content

Commit dacb148

Browse files
committed
Automatically kill existing instances of GRIP from the wrapper
As long as GRIP is always launched from the wrapper, this should prevent problems (such as OOM errors) from multiple instances of GRIP running
1 parent 9d8d79f commit dacb148

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)