Skip to content

Commit

Permalink
Remove errant PIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
Steveorevo committed Aug 14, 2024
1 parent f2acd63 commit def865c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion vscode.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,12 @@ public function update_token( $user ) {
// Find the node vscode pid for the given user
$cmd = "ps axo user:20,pid,args | grep \"/opt/vscode/node /opt/vscode/out/server-main.js\" | grep $user | awk '{print $2}'";
$pid = trim( shell_exec( $cmd ) );
// Restart the vscode server for the given user
if ( $pid ) {
// Turn $pid into space separated list of pids to kill them all
$pid = str_replace( PHP_EOL, ' ', $pid );
shell_exec( "kill $pid" );

// Restart the VSCode service manually (outside of PM2).
Expand Down

0 comments on commit def865c

Please sign in to comment.