javascript
Published on January 26, 2024By DeveloperBreeze
// Import 'child_process' module
const { exec } = require('child_process');
// Execute 'ls -l' command
exec('ls -l', (error, stdout, stderr) => {
// Check for errors
if (error) {
console.error('Error:', error);
return;
}
// Log the result
console.log('Result:', stdout);
});
Comments
Please log in to leave a comment.