Verified Commit 7582d763 authored by Aral Balkan's avatar Aral Balkan
Browse files

Create generic serverWithArgs() method as streaming alt to command()

parent 35d4f708
......@@ -42,7 +42,8 @@ class Hugo {
async command (args) {
const hugoCommand = `${this.hugoBinaryPath} ${args}`
const options = {
env: process.env
env: process.env,
stdio: 'pipe',
}
const result = await exec(hugoCommand, options)
......@@ -85,6 +86,15 @@ class Hugo {
'--appendPort=false',
'--disableFastRender'
]
return this.serverWithArgs(args)
}
// Starts a generic Hugo server
serverWithArgs (args) {
// Args should be an array. Automatically convert an arguments string to one.
if (typeof args === 'string') {
args = args.split(' ')
}
const options = { env: process.env }
const hugoServerProcess = spawn(this.hugoBinaryPath, args, options)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment