Skip to content
This repository was archived by the owner on Feb 11, 2020. It is now read-only.

Commit 32a8625

Browse files
author
Dr. Safi
committed
Update execution implementation for shellscript unit - working.
1 parent 4aff74a commit 32a8625

File tree

1 file changed

+16
-1
lines changed
  • module/reusableNestedUnit/implementation/shellscript

1 file changed

+16
-1
lines changed

module/reusableNestedUnit/implementation/shellscript/Unit.class.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { classDecorator as prototypeChainDebug} from 'appscript/module/prototype
22
import { add, execute, applyMixin, conditional } from 'appscript/utilityFunction/decoratorUtility.js'
33
import { extendedSubclassPattern } from 'appscript/utilityFunction/extendedSubclassPattern.js'
44
import { curried as getTableDocumentCurried } from "appscript/utilityFunction/database/query/getTableDocument.query.js";
5+
import { exec, spawn, spawnSync } from 'child_process'
56

67
let getDocument = {
78
'Unit': getTableDocumentCurried({ documentId: 'shellscript_unit' })
@@ -17,7 +18,21 @@ export default ({ Superclass }) => {
1718
@extendedSubclassPattern.Subclass()
1819
class Unit extends Superclass {
1920
async executeScript() {
20-
console.log(this)
21+
switch (this.implementation) {
22+
case 'spawn':
23+
let message = ` _____ _
24+
| ____|__ __ ___ ___ _ _ | |_ ___
25+
| _| \\ \\/ // _ \\ / __|| | | || __|/ _ \\
26+
| |___ > <| __/| (__ | |_| || |_| __/
27+
|_____|/_/\\_\\\\___| \\___| \\__,_| \\__|\\___|
28+
${this.command} ${this.argument}`;
29+
console.log(message)
30+
spawnSync(this.command, this.argument, this.option)
31+
break;
32+
default:
33+
console.log('shellscriptUnit.implementation does not match any option.')
34+
break;
35+
}
2136
}
2237
}
2338
return self

0 commit comments

Comments
 (0)