Skip to content

Commit

Permalink
fix: replace exec with execsync for immediate process
Browse files Browse the repository at this point in the history
  • Loading branch information
johackim committed Apr 11, 2024
1 parent ba0d820 commit d083813
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion __tests__/daemon.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jest.mock('socket.io-client', () => ({

beforeEach(() => {
jest.spyOn(console, 'log').mockImplementation(() => {});
jest.spyOn(childProcess, 'exec').mockImplementation(() => {});
jest.spyOn(childProcess, 'execSync').mockImplementation(() => {});
jest.spyOn(Utils, 'isSudo').mockReturnValue(true);
jest.spyOn(Utils, 'getRunningBlockedApps').mockReturnValue([{ name: 'chromium', pid: 123 }]);
jest.spyOn(Utils, 'updateResolvConf').mockImplementation(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/daemon.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { exec } from 'child_process';
import { execSync } from 'child_process';
import {
config,
isSudo,
Expand All @@ -17,7 +17,7 @@ const handleAppBlocking = () => {
const blockedApps = getRunningBlockedApps();

for (const app of blockedApps) {
exec(`kill -9 ${app.pid}`);
execSync(`kill -9 ${app.pid}`);
console.log(`Blocking ${app.name}`);
sendNotification('Ulysse', `Blocking ${app.name}`);
}
Expand Down

0 comments on commit d083813

Please sign in to comment.