Код: Выделить всё
const { exec } = require("child_process");
const fs = require("fs");
const path = require("path");
const outputPath = path.join(__dirname, "outputs");
if (!fs.existsSync(outputPath)) {
fs.mkdirSync(outputPath, { recursive: true });
}
const executeCSharp = (filepath) => {
const jobId = path.basename(filepath).split(".")[0];
const outPath = path.join(outputPath, `${jobId}.out`);
return new Promise((resolve, reject) => {
exec(
`csc -out:${outPath} ${filepath}`,
(error, stdout, stderr) => {
if (error) {
console.error(`${error}`);
reject(error);
return;
}
exec(
outPath,
(error, stdout, stderr) => {
if (error) {
reject({ error, stderr});
return;
}
resolve(stdout);
}
);
}
);
});
};
module.exports = {
executeCSharp,
};
Я пытался создать параметр C# в своем компиляторе, однако, когда я нажимаю кнопку выполнения в своем приложении, я сталкиваюсь с такой проблемой:
Не удалось загрузить ресурс: net::ERR_CONNECTION_REFUSED
Подробнее здесь: https://stackoverflow.com/questions/784 ... in-console
Мобильная версия