Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Site.js
lib
Node Hugo
Commits
7582d763
Verified
Commit
7582d763
authored
Feb 12, 2020
by
Aral Balkan
Browse files
Create generic serverWithArgs() method as streaming alt to command()
parent
35d4f708
Changes
1
Hide whitespace changes
Inline
Side-by-side
index.js
View file @
7582d763
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment