Skip to content

Smooth Exit #143

@grant

Description

@grant

The FF should smoothly exit, even with a process interrupt. This would create a better developer experience.

This is what a user sees when we CTRL-C:

Serving function...
Function: function
URL: http://localhost:8080/
^CReceived SIGINT
Error: Process exited with code 0
    at process.<anonymous> (<folder>/node_modules/@google-cloud/functions-framework/build/src/invoker.js:396:29)
    at process.emit (events.js:203:13)
    at process.EventEmitter.emit (domain.js:471:20)
    at process.exit (internal/process/per_thread.js:158:15)
    at Server.<anonymous> (<folder>/node_modules/@google-cloud/functions-framework/build/src/invoker.js:402:29)
    at Object.onceWrapper (events.js:291:20)
    at Server.emit (events.js:203:13)
    at Server.EventEmitter.emit (domain.js:471:20)
    at emitCloseNT (net.js:1572:8)
    at processTicksAndRejections (internal/process/task_queues.js:77:11)

Source:

process.on('exit', code => {
  logAndSendError(new Error(`Process exited with code ${code}`), latestRes);
});

We're not really doing any good by logging the stacktrace of the Node process, maybe a one-liner error would be better.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions