Skip to content

Commit 7f77b57

Browse files
nullpilotmactanxin
authored andcommitted
feat(cli): add stdin flag to serve (vuejs#2411)
* feat(cli): add stdin flag to serve * add back --public help * reorder help
1 parent 003e919 commit 7f77b57

File tree

1 file changed

+11
-0
lines changed
  • packages/@vue/cli-service/lib/commands

1 file changed

+11
-0
lines changed

packages/@vue/cli-service/lib/commands/serve.js

+11
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module.exports = (api, options) => {
1919
options: {
2020
'--open': `open browser on server start`,
2121
'--copy': `copy url to clipboard on server start`,
22+
'--stdin': `close when stdin ends`,
2223
'--mode': `specify env mode (default: development)`,
2324
'--host': `specify host (default: ${defaults.host})`,
2425
'--port': `specify port (default: ${defaults.port})`,
@@ -204,6 +205,16 @@ module.exports = (api, options) => {
204205
})
205206
})
206207

208+
if (args.stdin) {
209+
process.stdin.on('end', () => {
210+
server.close(() => {
211+
process.exit(0)
212+
})
213+
})
214+
215+
process.stdin.resume()
216+
}
217+
207218
// on appveyor, killing the process with SIGTERM causes execa to
208219
// throw error
209220
if (process.env.VUE_CLI_TEST) {

0 commit comments

Comments
 (0)