async file write

This commit is contained in:
Naveenraj M
2020-03-29 20:26:18 +05:30
parent 7e607fe325
commit c3f01090b0
4 changed files with 16 additions and 3 deletions

View File

@ -25,7 +25,12 @@ function download_archive(owner, repo, ref) {
archive_format, archive_format,
ref ref
}).then(({ data }) => { }).then(({ data }) => {
fs.writeFileSync(tarFile, Buffer.from(data)); fs.writeFile(tarFile, Buffer.from(data), function (err) {
if (err) {
return console.log(err);
}
console.log("The Tar file was saved!");
});
}).catch(function (error) { }).catch(function (error) {
console.log(error); console.log(error);
}); });

View File

@ -28,6 +28,8 @@ function run() {
console.log(`Hello ${specFile} from inside a container`); console.log(`Hello ${specFile} from inside a container`);
// Get repo files from /github/workspace/ // Get repo files from /github/workspace/
yield exec.exec('ls -la /github/workspace'); yield exec.exec('ls -la /github/workspace');
// Get repo files from /github/workspace/
yield exec.exec('ls -la ');
// Copy spec file from path specFile to /root/rpmbuild/SPECS/ // Copy spec file from path specFile to /root/rpmbuild/SPECS/
yield io.cp('/github/workspace/cello.spec', '/root/rpmbuild/SPECS/'); yield io.cp('/github/workspace/cello.spec', '/root/rpmbuild/SPECS/');
// Get tar.gz file of release // Get tar.gz file of release

View File

@ -21,7 +21,12 @@ async function download_archive(owner, repo, ref ) {
archive_format, archive_format,
ref ref
}).then(( { data }) => { }).then(( { data }) => {
fs.writeFileSync(tarFile, Buffer.from(data)); fs.writeFile(tarFile, Buffer.from(data), function(err){
if(err) {
return console.log(err);
}
console.log("The Tar file was saved!");
});
}).catch( function(error){ }).catch( function(error){
console.log(error); console.log(error);
}); });

View File

@ -26,7 +26,8 @@ async function run() {
// Get repo files from /github/workspace/ // Get repo files from /github/workspace/
await exec.exec('ls -la /github/workspace'); await exec.exec('ls -la /github/workspace');
// Get repo files from /github/workspace/
await exec.exec('ls -la ');
// Copy spec file from path specFile to /root/rpmbuild/SPECS/ // Copy spec file from path specFile to /root/rpmbuild/SPECS/
await io.cp('/github/workspace/cello.spec', '/root/rpmbuild/SPECS/'); await io.cp('/github/workspace/cello.spec', '/root/rpmbuild/SPECS/');