-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest.js
More file actions
30 lines (26 loc) · 695 Bytes
/
test.js
File metadata and controls
30 lines (26 loc) · 695 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const execAsync = require('./index');
const handleError = require('node-cli-handle-error');
(async () => {
try {
// executes a shell command asynchronously
await execAsync({ cmd: `touch abc.md` });
// changes directory and then run the shell command inside that directory
await execAsync({
path: `/Users/saadirfan/Desktop`,
cmd: `touch example.md`
});
// change directory and run a bunch of commands
const commands = [
`mkdir saad`,
`npm install`,
`npm install --only=dev`
];
await execAsync({
path: `/Users/saadirfan/Desktop/example`,
cmd: commands
});
console.log(`Will execute after commands...`);
} catch (err) {
handleError(err);
}
})();