shell: add options to exec

This commit is contained in:
Girish Ramakrishnan
2024-02-20 21:11:09 +01:00
parent 7ce5b53753
commit 26eb739b46
9 changed files with 45 additions and 44 deletions
+4 -4
View File
@@ -53,24 +53,24 @@ describe('shell', function () {
});
it('execSync a valid shell program', function (done) {
shell.exec('test', 'ls -l | wc -c', function (error) {
shell.exec('test', 'ls -l | wc -c', {}, function (error) {
done(error);
});
});
it('execSync a valid shell program (promises)', async function () {
await shell.promises.exec('test', 'ls -l | wc -c');
await shell.promises.exec('test', 'ls -l | wc -c', {});
});
it('execSync throws for invalid program', function (done) {
shell.exec('test', 'cannotexist', function (error) {
shell.exec('test', 'cannotexist', {}, function (error) {
expect(error).to.be.ok();
done();
});
});
it('execSync throws for failed program', function (done) {
shell.exec('test', 'false', function (error) {
shell.exec('test', 'false', {}, function (error) {
expect(error).to.be.ok();
done();
});