const spawn = require('child_process').spawn;
(async () => {
const promise = new Promise((resolve, reject) => {
const output = {
data: '',
errors: '',
};
options = [
'code.php',
];
const process = spawn('/opt/homebrew/bin/php', options);
process.stdout.on('data', (data) => {
output.data += data.toString();
});
process.stderr.on('data', (data) => {
output.errors += data.toString();
});
process.on('exit', (code) => {
resolve(output);
});
});
const data = await promise;
console.info(data);
})();
const { ProxyAgent } = require('undici');
const proxy = {
'host': 'xxx.xxx.xxx.xxx',
'port': 'xxx',
'username': 'xxx',
'password': '***',
};
const proxyAgent = new ProxyAgent({
uri: `http://${proxy.host}:${proxy.port}`,
token: `Basic ${Buffer.from(`${proxy.username}:${proxy.password}`).toString('base64')}`,
});
(async () => {
const data = await fetch('https://httpbin.org/get', { dispatcher: proxyAgent });
const json = await data.json();
await proxyAgent.close();
console.log(json);
})();
current.dataValues.count_col;
const { exec } = require('child_process');
exec('python test.py', (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
console.log(`stdout: ${stdout}`);
console.error(`stderr: ${stderr}`);
});
count = 0
while count < 1e6:
count = count + 1
print(count)