mirror of
https://github.com/naveenrajm7/rpmbuild.git
synced 2025-07-12 04:13:50 +00:00
using child process to get o/p
This commit is contained in:
23
lib/main.js
23
lib/main.js
@ -13,6 +13,7 @@ const github = require('@actions/github');
|
||||
const exec = require('@actions/exec');
|
||||
const io = require('@actions/io');
|
||||
const download_tar = require('./download-release-archive');
|
||||
const cp = require('child_process');
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
@ -54,18 +55,18 @@ function run() {
|
||||
// If you want to upload yourself , need to write api call to upload as asset
|
||||
//core.setOutput("rpmPath", rpmPath)
|
||||
let myOutput = '';
|
||||
let myError = '';
|
||||
const options = {};
|
||||
options.listeners = {
|
||||
stdout: (data) => {
|
||||
myOutput += data.toString();
|
||||
},
|
||||
stderr: (data) => {
|
||||
myError += data.toString();
|
||||
cp.exec('ls /github/home/rpmbuild/SRPMS/', (err, stdout, stderr) => {
|
||||
if (err) {
|
||||
//some err occurred
|
||||
console.error(err);
|
||||
}
|
||||
};
|
||||
options.cwd = '/github/home/rpmbuild/SRPMS/';
|
||||
yield exec.exec('ls', ['-C'], options);
|
||||
else {
|
||||
// the *entire* stdout and stderr (buffered)
|
||||
console.log(`stdout: ${stdout}`);
|
||||
myOutput = stdout;
|
||||
console.log(`stderr: ${stderr}`);
|
||||
}
|
||||
});
|
||||
core.setOutput("source_rpm_path", `/github/home/rpmbuild/SRPMS/${myOutput}`); // make option to upload source rpm
|
||||
}
|
||||
catch (error) {
|
||||
|
27
src/main.ts
27
src/main.ts
@ -3,6 +3,7 @@ const github = require('@actions/github');
|
||||
const exec = require('@actions/exec');
|
||||
const io = require('@actions/io');
|
||||
const download_tar = require('./download-release-archive');
|
||||
const cp = require('child_process');
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
@ -60,21 +61,19 @@ async function run() {
|
||||
// actions/upload-release-asset
|
||||
// If you want to upload yourself , need to write api call to upload as asset
|
||||
//core.setOutput("rpmPath", rpmPath)
|
||||
|
||||
let myOutput = '';
|
||||
let myError = '';
|
||||
|
||||
const options: any = { };
|
||||
options.listeners = {
|
||||
stdout: (data: Buffer) => {
|
||||
myOutput += data.toString();
|
||||
},
|
||||
stderr: (data: Buffer) => {
|
||||
myError += data.toString();
|
||||
}
|
||||
};
|
||||
options.cwd = '/github/home/rpmbuild/SRPMS/';
|
||||
|
||||
await exec.exec('ls', [ '-C' ], options);
|
||||
cp.exec('ls /github/home/rpmbuild/SRPMS/', (err, stdout, stderr) => {
|
||||
if (err) {
|
||||
//some err occurred
|
||||
console.error(err)
|
||||
} else {
|
||||
// the *entire* stdout and stderr (buffered)
|
||||
console.log(`stdout: ${stdout}`);
|
||||
myOutput = stdout;
|
||||
console.log(`stderr: ${stderr}`);
|
||||
}
|
||||
});
|
||||
|
||||
core.setOutput("source_rpm_path", `/github/home/rpmbuild/SRPMS/${myOutput}`); // make option to upload source rpm
|
||||
|
||||
|
Reference in New Issue
Block a user