Do we need the `await` when using `.then` when we call `executeCommand()` in for example:
https://github.com/Andrew-Colman/sync-fork/blob/d44269367f482ac97efc2374b52e94bd8fc8a816/lib/utils.js#L46-L52
From what i have read its ether `await` or `then...catch`
yes,
we're **await**ing for the value **then** using it
all inside a **try / catch**
```
catch (err) {
errorHandler(err); //invokes the custom error handler that gives custom messages
}
```
if we remove it:
```
cmd.then(
cmd.then(
cmd.then(
cmd.then(
).catch(e)
).catch(e)
).catch(e)
).catch(e)
```

>https://blog.avenuecode.com/callback-hell-promises-and-async/await
```js
try {
// Removed then, reads more like synchronous code
const { stdout } = await executeCommand(oneCommand)
if (!stdout.match('git version')) {
return log(solutions.gitNotInstalled)
} else {
return log(solutions.started)
}
const { stdout } = await executeCommand(twoCommand)
if (!stdout.match('..............')) {
return log(solutions......)
} else {
return log(solutions.....)
}
const { stdout } = await executeCommand(threeCommand)
if (!stdout.match('..............')) {
return log(solutions......)
} else {
return log(solutions.....)
}
const { stdout } = await executeCommand(fourCommand)
if (!stdout.match('..............')) {
return log(solutions......)
} else {
return log(solutions.....)
}
const { stdout } = await executeCommand(fiveCommand)
if (!stdout.match('..............')) {
return log(solutions......)
} else {
return log(solutions.....)
}
} catch (err) {
console.error(err)
}
```
- will be a bit confusing in terms of scope
- and re-creating the variables in the same scope of the main function **syncFork**()
- `const stdout` (I'm trying to stick close as possible with immutability)
-
```js
executeCommand(nameCommand) {
{stdout} //<- this stdout lives only in this scope, easy debuggable with a console.log and Stop();
}
```