Skip to content

Commit

Permalink
Node - Fix semgrep detected vulnerability in hybrid tests (valkey-io#…
Browse files Browse the repository at this point in the history
…1173)

Fix semgrep detected vulunrability
  • Loading branch information
avifenesh authored Mar 25, 2024
1 parent 2af4199 commit 09303ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions node/hybrid-node-tests/commonjs-test/commonjs-test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
const { AsyncClient } = require("glide-rs");
const RedisServer = require("redis-server");
const FreePort = require("find-free-port");
const PORT_NUMBER = 4001;
const { execFile } = require("child_process");

const PORT_NUMBER = 4001;
let server;
let port;

const { exec } = require("child_process");

function flushallOnPort(port) {
return new Promise((resolve, reject) => {
exec(`redis-cli -p ${port} FLUSHALL`, (error, _, stderr) => {
execFile("redis-cli", ["-p", port, "FLUSHALL"], (error, _, stderr) => {
if (error) {
console.error(stderr);
reject(error);
Expand Down
6 changes: 3 additions & 3 deletions node/hybrid-node-tests/ecmascript-test/ecmascript-test.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { exec } from "child_process";
import { execFile } from "child_process";
import findFreePorts from "find-free-ports";
import { AsyncClient } from "glide-rs";
import RedisServer from "redis-server";
Expand All @@ -7,9 +7,9 @@ const PORT_NUMBER = 4001;
let server;
let port;

export function flushallOnPort(port) {
function flushallOnPort(port) {
return new Promise((resolve, reject) => {
exec(`redis-cli -p ${port} FLUSHALL`, (error, _, stderr) => {
execFile("redis-cli", ["-p", port, "FLUSHALL"], (error, _, stderr) => {
if (error) {
console.error(stderr);
reject(error);
Expand Down

0 comments on commit 09303ef

Please sign in to comment.