Skip to content

Commit

Permalink
replaced execSync with execFileSync to fix codeql issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ruirochawork committed Sep 24, 2024
1 parent 99bf574 commit e865c12
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/nodejs-kafka-client-lib/generate-proto.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
const { execSync } = require('child_process');
const { execFileSync } = require('child_process');
const path = require('path');

const protoDir = path.resolve(__dirname, 'src/protobuff');
const protoFile = path.resolve(protoDir, 'messages.proto');
const outDir = path.resolve(protoDir);

const command = `protoc --ts_out=service=true:${outDir} --proto_path=${protoDir} ${protoFile}`;

console.log('Running command:', command);
const command = 'protoc';
const args = [
`--ts_out=service=true:${outDir}`,
`--proto_path=${protoDir}`,
protoFile
];

try {
execSync(command, { stdio: 'inherit' });
execFileSync(command, args, { stdio: 'inherit' });
} catch (error) {
console.error('Error executing command:', error);
process.exit(1);
}
}

0 comments on commit e865c12

Please sign in to comment.